node-sass 安装失败解决办法

node-sass 安装失败解决办法

问题

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\zhuon\AppData\Local\Programs\Python\Python36\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack   at PythonFinder.failNoPython (G:\Workspace\ManYan\manyan-nav\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack   at PythonFinder.<anonymous> (G:\Workspace\ManYan\manyan-nav\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack   at G:\Workspace\ManYan\manyan-nav\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack   at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\dev\\nodejs\\node.exe" "G:\\Workspace\\ManYan\\manyan-nav\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags="
"--libsass_library="
gyp ERR! cwd G:\Workspace\ManYan\manyan-nav\node_modules\node-sass
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed
npm WARN co-mocha@1.2.0 requires a peer of mocha@>=1.18 <4 but none was installed.
npm WARN egg-restapi-module-tool@1.0.0 No repository field.
npm WARN egg-restapi-module-tool@1.0.0 scripts['server'] should probably be scripts['start'].
 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.8.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.8.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 
npm ERR! A complete log of this run can be found in:
npm ERR!   D:\nodejs\cache\_logs\2017-09-02T16_06_24_298Z-debug.log

问题原因
原因一 node-sass安装失败
原因二 nodejs与node-sass版本冲突(后面有解释)

解决办法
安装失败了一定要先卸载 否则不会重新下载会一直报错
卸载
npm uninstall node-sass
设置为淘宝镜像(这是设置的全局镜像地址,以后都会在这上面下载)
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
重新安装
npm install node-sass@你的版本号

方案二

nodejs与node-sass版本冲突
nodejs10.x与node-sass4.5.3版本不匹配。
查看nodejs版本 cmd控制台 node -v

node-sass4.5.3最高支持 nodejs8.x版本的所以下载失败

10版本64
在这里插入图片描述
node-sass4.5.3最高支持nodejs 57
在这里插入图片描述
解决办法nodejs下降版本,或将node-sass升级

官网网址

nodes-sass releases地址:https://github.com/sass/node-sass/releases
nodejs releases地址:https://nodejs.org/zh-cn/download/releases/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值