search

Home  >  Q&A  >  body text

javascript - Why do I always get an error when installing Node-Sass using npm?

错误代码:
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_leeringa_lee2746 days ago2206

reply all(4)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-07-06 10:37:57

    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/

    reply
    0
  • 三叔

    三叔2017-07-06 10:37:57

    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.

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-07-06 10:37:57

    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

    reply
    0
  • PHP中文网

    PHP中文网2017-07-06 10:37:57

    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)

    reply
    0
  • Cancelreply