将软件包添加到Windows 7中的meteor应用程序时出现“node-gyp rebuild”安装错误

时间:2015-07-24 00:12:16

标签: node.js windows meteor npm node-gyp

我试图在我的Meteor应用程序中添加一个包(mizzao:turkserver),但我一直收到这个错误:

mizzao:turkserver: updating npm dependencies -- request, libxmljs,
validator, querystring, async, deepmerge...  
gypnpm ERR! Windows_NT 6.1.7601  
npm ERR! argv  
"C:\\Users\\PC4all\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os
.windows.x86_32\\dev_bundle\\bin\\\\node.exe"
"C:\\Users\\PC4all\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os
.windows.x86_32\\dev_bundle\\bin\\node_modules\\npm\\bin\\npm-cli.js"  
"install" "libxmljs@0.8.1"  
npm ERR! node v0.10.36  
npm ERR! npm  v2.7.3  
npm ERR! code ELIFECYCLE  

npm ERR! libxmljs@0.8.1 install: `node-gyp rebuild`  
npm ERR! Exit status 7  
npm ERR!  
npm ERR! Failed at the libxmljs@0.8.1 install script 'node-gyp rebuild'.  
npm ERR! This is most likely a problem with the libxmljs package,  
npm ERR! not with npm itself.  
npm ERR! Tell the author that this fails on your system:  
npm ERR!     node-gyp rebuild  
npm ERR! You can get their info via:  
npm ERR!     npm owner ls libxmljs  
npm ERR! There is likely additional logging output above.  

=> Babel active on file extensions: es6.js, es6, jsx    
=> Errors while adding packages:

While building package mizzao:turkserver:  
error: couldn't install npm package  

我正在Windows 7机器上开发我的Meteor应用程序,而且我从论坛上的帖子中收集的内容,错误似乎与那个事实有关(npm和Windows之间的交互 ​​- 我没有找到任何帖子在Linux机器上描述相同的问题。)

我已按照此处的建议尝试安装最新的Python版本和MS Visual Studio 2013:https://github.com/TooTallNate/node-gyp#installation,并按照此处的建议设置一些环境变量:https://github.com/atom/atom/issues/2754。但这些都没有帮助。

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

正如我在this comment中所描述的那样,这似乎是因为npm错误地设置了Python路径的问题,因为流星的npm分布并没有正确地将它连接起来。大多数Linux发行版都附带Python,但Windows并不存在,因此它与运行Windows相关。

可以通过确保安装Python来修复,然后运行以下命令:

npm config set python C:\Python27\python.exe

使用旧版libxmljs是因为mizzao:turkserver依赖于相对较旧的node MTurk API,我希望在某些时候将其断开,但不是{&1}}现在这么高的优先级。

另见: