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

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

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应用程序,并且从论坛上的post可以收集到的错误似乎与这个事实有关(npm和Windows之间的交互 ​​- 我没有发现任何描述相同的post在Linux机器上的问题)。

我已经尝试安装最新的Python版本和MS Visual Studio 2013,如下所示: https : //github.com/TooTallNate/node-gyp#installation ,以及设置一些环境variables,如下所示: https:// github.com/atom/atom/issues/2754 。 但没有一个帮助。

任何帮助将不胜感激!

正如我在这个评论中所描述的,这似乎是Python路径被设置为npm不正确的一个问题,因为流星的npm分布不能正确地连接它。 大多数Linux发行版都附带了Python,但Windows并没有,所以它与运行Windows相关。

可以通过确保安装Python来解决该问题,然后运行以下命令:

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

使用旧的libxmljs是因为mizzao:turkserver依赖于一个相对较旧的节点MTurk API ,我想在某些时候将其淘汰,但目前并不是那么重要。

也可以看看: