Windows 8:`node-gyp rebuild` 退出状态 1,安装 zombie 的依赖 contextify
我正在尝试安装 zombie js,但遇到了这个错误:
> contextify@0.1.8 install
C:\Users\User\Documents\ArbeitPhilipp\clieman\billing\node_modules\zombie\node_modules\jsdom\node_modules\contextify
> node-gyp rebuild
Das System kann den angegebenen Pfad nicht finden.
C:\Users\User\Documents\ArbeitPhilipp\clieman\billing\node_modules\zombie\node_modules\jsdom\node_modules\contextify>node "C:\Program Files (x86)\nodejs\nod
e_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack at errnoException (child_process.js:980:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:771:34)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd
C:\Users\User\Documents\ArbeitPhilipp\clieman\billing\node_modules\zombie\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
我使用的是 Windows 8(64位)
Node 版本:v0.10.24(32位)
npm 版本:1.3.21
Python 版本:2.7(32位)
Python 的路径已经添加到环境变量中(C:\Python27\python.exe;)
PYTHONPATH : C:\Python27\
PYTHON : C:\Python27\python.exe
npm install --verbose contextify 2>&1 | grep gyp
输出结果是:
C:\Users\User\Documents\ArbeitPhilipp\clieman\billing\node_modules\contextify>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\n
ode_modules\node-gyp\bin\node-gyp.js" rebuild
gyp npm verb unsafe-perm in lifecycle true
npm ERR! contextify@0.1.8 install: `node-gyp rebuild`
npm ERR! node-gyp rebuild
我已经阅读了所有相关的问题,但没有找到能帮助我的解决方案。
如果有人能提供帮助,我将非常感激!
6 个回答
我之前也遇到过同样的问题,试了很多这里推荐的解决办法(比如安装不同年份的微软VS版本),但都没成功。不过最后我终于搞定了。可能是我用的这些方法组合在一起才奏效,但我觉得以下步骤是关键:
- 安装Python 2.7。最简单的方法是用Chocolatey,只需要输入
choco install python2
就可以了。 - 安装Visual Studio Express 2013 for Windows Desktop。同样通过Chocolatey,只需输入
choco install visualstudioexpress2013windowsdesktop
,这样可以确保你下载到正确的版本。
安装完这些后,要更新一下Python的环境变量。Chocolatey会把它安装在 C:\tools\python2
这个位置。最后,别忘了关闭并重新打开你的命令提示符。
在这里下载 Visual Studio Express 2013: http://www.microsoft.com/en-us/download/details.aspx?id=43729
我遇到过类似的问题,甚至可以说是完全一样的!最后在运行 node-gyp rebuild 或 npm install 的时候,我注意到出现了一个错误信息:“MSBUILD : error MSB4132: 工具版本 '2.0' 无法识别。可用的工具版本是 '4.0'。”
我在谷歌上找到了这个解决方案:https://github.com/chjj/pty.js/issues/60,他说“安装一个 Visual Studio Express 2013(带 C++ 运行库),这会有帮助。”
你可以在这里下载:http://www.microsoft.com/en-gb/download/details.aspx?id=40787
以管理员身份打开命令提示符 -> 输入 npm install -> 一切都正常工作!:D
希望这能帮到你!
祝好,
Greg
如果有人遇到这个问题:我们通过手动调试找到了原因,问题出在一个节点绑定脚本上,这个脚本在为msbuild创建构建脚本时执行了node.exe。
contextify中的binding.gyp包含了以下内容:
'include_dirs': ["<!(node -e \"require('nan')\")"],
这段代码导致了以下错误:
Das System kann den angegebenen Pfad nicht finden
(系统找不到指定的路径
)
即使知道python无法调用node.exe并找到require("nan")模块,我们还是放弃了这个问题。如果有人有更多的见解,请分享。我因为这个问题失眠了;)