您的位置:首页技术文章
文章详情页

javascript - 用npm安装Node-Sass老是报错是怎么回事?

浏览:38日期:2023-08-25 11:51:50

问题描述

错误代码:gyp ERR! configure errorgyp ERR! stack Error: Can’t find Python executable 'python', you can set the PYTHON env variable.gyp ERR! stack at PythonFinder.failNoPython (C:Users***AppDataRoamingnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:483:19)gyp ERR! stack at PythonFinder.<anonymous> (C:Users***AppDataRoamingnpmnode_modulesnode-sassnode_modulesnode-gyplibconfigure.js:508:16)gyp ERR! stack at C:Users***AppDataRoamingnpmnode_modulesnode-sassnode_modulesgraceful-fspolyfills.js:284:29gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)gyp ERR! System Windows_NT 6.1.7601gyp ERR! command 'D:Program Filesnodejsnode.exe' 'C:Users*AppDataRoamingnpmnode_modulesnode-sassnode_modulesnode-gypbinnode-gyp.js' 'rebuild' '--verbose' '--libsass_ext=' '--libsass_cflags=' '--libsass_ldflags=' '--libsass_library='gyp ERR! cwd C:Users***AppDataRoamingnpmnode_modulesnode-sassgyp ERR! node -v v8.0.0gyp ERR! node-gyp -v v3.6.2gyp ERR! not okBuild failed with error code: 1npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@4.5.3 postinstall: node scripts/build.jsnpm ERR! Exit status 1npm 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 logging 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。

问题解答

回答1:

在跟package.json同目录创一个名为.npmrc的文件,然后装个python,最好是2.X版本

把下面这句东西放进去

sass_binary_site=https://npm.taobao.org/mirrors/node-sass/回答2:

提示是需要安装python,可以安装个python试试,然后配下PYTHON 的环境变量,重新安装试试看。

回答3:

根目录创建.npmrc

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

保存后 重新npm install

回答4:

我昨天也试过安装nodesass失败,后面转用淘宝镜像装就成功了$ npm install -g cnpm --registry=https://registry.npm.taobao.org (安装淘宝镜像)

$ cnpm install node-sass --save (使用淘宝镜像安装node-sass)

标签: JavaScript
相关文章: