您的位置:首页 > 产品设计 > 产品经理

npm安装某些包在windows下遇到的错误

2017-03-17 19:58 253 查看
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:\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:454:19)
gyp ERR! stack     at PythonFinder.<anonymous> (E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:480:16)
gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:114:15)
gyp ERR! System Windows_NT 10.0.15048
gyp ERR! command "E:\\nodejs\\node.exe" "E:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\gulp-angular\node_modules\bufferutil
gyp ERR! node -v v7.7.1
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok

> utf-8-validate@1.2.2 install G:\gulp-angular\node_modules\utf-8-validate
> node-gyp rebuild

G:\gulp-angular\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "E:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
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:\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:454:19)
gyp ERR! stack     at PythonFinder.<anonymous> (E:\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:480:16)
gyp ERR! stack     at E:\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:114:15)
gyp ERR! System Windows_NT 10.0.15048
gyp ERR! command "E:\\nodejs\\node.exe" "E:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\gulp-angular\node_modules\utf-8-validate
gyp ERR! node -v v7.7.1
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok


这个错误是Windows编译的问题,要解决

一是换Linux,不得不说Linux环境比windows好太多

当然很多人怕麻烦那就只有安装编译环境了,错误说缺少python环境就先装python。装完后,我估计会提醒没有c++的组件继续报错,然后在安装vs就可以了

解决方法:

安装Python2.7 , 安装vs2015社区版

还有向大家提个醒,最好不要在Windows环境下使用sass,需要Ruby环境,很麻烦,我曾经在这个问题上反复打转,最终还是放弃写sass。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nodejs npm python
相关文章推荐