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好,哪有这么多麻烦事

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值