安装node-sass出现的问题

用npm安装node-sass的时候一直安装不成功,在网上搜了搜,终于解决了!

报错

这是在npm install node-sass --save-dev时报的错:

...
gyp ERR! configure error
gyp ERR! stack Error: Can\'t find Python executable \"python\", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (E:\\vue\\store\\node_modules\\node-gyp\\lib\\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (E:\\vue\\store\\node_modules\\node-gyp\\lib\\configure.js:509:16)
gyp ERR! stack     at E:\\vue\\store\\node_modules\\graceful-fs\\polyfills.js:282:31
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command \"F:\\\\nodeJs\\\\node.exe\" \"E:\\\\vue\\\\store\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"rebuild\" \"--verbose\" \"--libsass_ext=\" \"--libsass_cflags=\" \"--libsass_ldflags=\" \"--libsass_library=\"
gyp ERR! cwd E:\\vue\\store\\node_modules\\node-sass
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
...

emmm,实在不懂

解决办法

在网上看了各位大神的解决办法,然后自己试了试。发现使用淘宝镜像安装就可以了。但是得先把错误的删除。
npm uninstall node-sass
删除完成后,再重新使用淘宝的镜像安装
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/

终于成功了!

感言

自己着实是个菜鸡,前端的路还很远。路漫漫其修远兮,欢迎各位大神指教。

收藏 打印