javascript - Why do I always get an error when installing Node-Sass using npm?
ringa_lee
ringa_lee 2017-07-06 10:35:57
0
4
2196

错误代码:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:Users***AppDataRoami
ngnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:Users***AppDataRoamin
gnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:508:16)
gyp ERR! stack at C:Users***AppDataRoamingnpmnode_modulesnode-sa
ssnode_modulesgraceful-fspolyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\Program Files\nodejs\node.exe" "C:\Users\*\App
Data\Roaming\npm\node_modules\node-sass\node_modules\node-gyp\bin\node-g
yp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldf
lags=" "--libsass_library="
gyp ERR! cwd C:Users***AppDataRoamingnpmnode_modulesnode-sass
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.5.3 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.5.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:Users***AppDataRoamingnpm-cache_logs2017-07-06T01_07_
47_983Z-debug.log

求大佬指点,给大佬递茶。公司内网,代理已经配置好,不过我的权限可能有的网站和端口会访问不了,github能上,node.js官网能上,源用的是cnpm。

ringa_lee
ringa_lee

ringa_lee

reply all(4)
淡淡烟草味

Create a file named .npmrc in the same directory as package.json, and then install python, preferably version 2.X

Put the following sentence in it

sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
三叔

The prompt is that you need to install python. You can install python and try it, then set the PYTHON environment variable and reinstall it.

扔个三星炸死你

Create .npmrc in the root directory

phantomjs_cdnurl=http://cnpmjs.org/downloads
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org

After saving, re-npm install

Ty80

I also tried to install nodesass yesterday and it failed. Later I switched to Taobao mirror and installed it successfully
$ npm install -g cnpm --registry=https://registry.npm.taobao.org (install Taobao mirror)

$ cnpm install node-sass --save (use Taobao image to install node-sass)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template