node-sass安装失败解决

老项目安装node-sass@4.14.1一直失败

"node-sass": "^4.14.1",

报错环境变量Path 中没有 python2.7

gyp verb check python checking for Python executable "python2.7" in the PATH

安装python2.7,然后设置npm config set python C:\Python27

安装node-sass还是报错,看网上说用cnpm装node-sass,试了下安装node-sass 成功了
在这里插入图片描述

我的node版本是16.14.0,node-sass@4.14最高只支持14,换到14版本的node,又报错了

Module build failed: Error: Missing binding F:\electricity-tools\node_modules\node-sass\vendor\win32-x64-83\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 14.x

Found bindings for the following environments:
  - Windows 64-bit with Unsupported runtime (93)

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
    at module.exports (F:\electricity-tools\node_modules\node-sass\lib\binding.js:15:13)       
    at Object.<anonymous> (F:\electricity-tools\node_modules\node-sass\lib\index.js:14:35)     
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at getDefaultSassImpl (F:\electricity-tools\node_modules\sass-loader\dist\index.js:198:10) 
    at Object.loader (F:\electricity-tools\node_modules\sass-loader\dist\index.js:80:29)       

 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-740ccae4","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=1!./src/views/gift-center/online-order/index.vue 4:14-394 13:3-17:5 14:22-402
 @ ./src/views/gift-center/online-order/index.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://0.0.0.0:8088 webpack/hot/dev-server ./src/main.js 

根据提示npm rebuild node-sass ,执行一下这个命令,最后项目终于跑起来了

话说这node-sass是真恶心,就没几次顺利安装成功过

还是用less好,哪有这么多麻烦事

相关推荐

  1. NVM切换Node版本失败(已解决

    2024-04-23 18:22:01       17 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-23 18:22:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-23 18:22:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-23 18:22:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-23 18:22:01       20 阅读

热门阅读

  1. RedisTemplate 与StringRedisTemplate区别

    2024-04-23 18:22:01       13 阅读
  2. Rust常用特型之AsRef和AsMut特型

    2024-04-23 18:22:01       14 阅读
  3. adb---调试连接设备

    2024-04-23 18:22:01       13 阅读
  4. Python中的Map函数:简化你的循环和函数调用

    2024-04-23 18:22:01       18 阅读
  5. Python网络爬虫项目开发实战:怎么处理下载缓存

    2024-04-23 18:22:01       12 阅读
  6. 浏览器原理之浏览器同源策略

    2024-04-23 18:22:01       16 阅读