javascript - 用npm安装Node-Sass老是报错是怎么回事?
问题描述
错误代码: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)
相关文章:
1. 求大神帮我看看是哪里写错了 感谢细心解答2. 冒昧问一下,我这php代码哪里出错了???3. python - 如何使用jsom.dumps获得完整的json数据?4. python2.7 - 在Eclipse开发Python,怎么去掉控制台输出的其他消息??5. python - django里GROUP BY 如何写这样的mysql语句?6. mysql - 数据库批量插入数据的速度是否与索引有关?7. css - 手机浏览器的兼容问题,微信和其它下载的浏览器打开没有问题,谷歌也测试过,就是手机自带的浏览器有问题。8. mysql - SQL问个基础例子,书上的,我怎么看都看不懂..谁帮我解释一下第2个为什么和第1个一样?9. 数据库安全 - 在公网上部署mysql数据库,安全方面需要做到哪些注意事项10. php - C#如何解析想mysql的my.ini这样的内容格式?
