Aurelia npm安装:吨的"gyp ERR" [英] Aurelia npm install: tons of "gyp ERR"
问题描述
这些类型的问题一角钱,我经历了一个又一个资源,但似乎没有任何效果:
These types of questions are a dime a dozen, and I've gone through resource after resource but nothing seems to work:
- https://github.com/nodejs/node-gyp/issues/629
- NodeJS-使用NPM安装时出错
- http://blog.jimdhughes.com/2015/04/09/perils-with-node-gyp-and-windows-development/
- https://github.com/nodejs/node-gyp/issues/629
- NodeJS - Error installing with NPM
- http://blog.jimdhughes.com/2015/04/09/perils-with-node-gyp-and-windows-development/
这是一笔交易,对于NodeJS和Aurelia来说我还很陌生,但是我的传闻经验是,随着最近的前端革命的到来以及其所有工具的出现,人们确实使事情看起来看似简单.
我确定我们都已经看到类似于以下命令:只要运行do my-work-for-me
,您的项目就完成了!"
Here's the deal, I'm pretty new to NodeJS and Aurelia, however my ancedotal experience is that with the advent of the recent front-end revolution and with all of its tooling, folks really made things look deceptively simple.
I'm sure we've all seen commands akin to: "just run do my-work-for-me
and your project is done!"
以 Aurelia指南.导航到工作目录后,只需执行以下操作:
Take for instance the Aurelia guide. After navigating to the working directory, all you need to do is run:
npm install
嗯,不. npm install
取决于node-gyp
,您必须手动安装.好吧,在安装Python之前您不能安装node-gyp
.但是请不要获取最新版本,因为不支持>3.x.安装后,您会遇到node-gyp
所需的C ++编译器问题.因此,我们安装了Microsoft VS 2012以获取编译器.
Well, no. npm install
depends on node-gyp
, which you must install manually. Well, you can't install node-gyp
before you install Python. But don't get the latest one, since > 3.x is not supported. Once you install that, you encounter issues with C++ compilers required by node-gyp
. So we install Microsoft VS 2012 to get the compilers.
我所做的事情:
-
将PYTHON设置为环境变量
Set PYTHON as an environment variable
C:\Users\[name]>py
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
如getter所示,在npm中设置适用的VS版本:
Set the applicable VS version in npm, as proven by the getter:
C:\Users\[name]>npm config get msvs_version
2012
也就是说,当我尝试从应用程序的目标目录运行npm install
时,仍然遇到以下错误:
That said, I still encounter the following error when I attempt to run npm install
from my application's target directory:
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit c
ode: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\nod
e-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:88:13)
gyp ERR! stack at ChildProcess.emit (events.js:173:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:201:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm
\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\_workspaces\skeleton-navigation-1.0.0-beta.1.0.2\node_modules\utf-8-validate
gyp ERR! node -v v5.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1
推荐答案
我真的很不喜欢回答自己的问题,但是我可以通过以下步骤解决此问题:
I really, truly don't like answering my own questions, but I was able to resolve this by taking the following steps:
- 卸载Node.js
- 卸载Microsoft Visual Studio 2012
- 卸载所有剩余的C ++ 2010 x86/x64可再发行组件
- 重新安装Node.js
- 使用Node.js重新安装
npm
- 安装Microsoft Studio 2013(快速桌面)
- Uninstall Node.js
- Uninstall Microsoft Visual Studio 2012
- Uninstall any remaining C++ 2010 x86/x64 redistributables
- Reinstall Node.js
- Use Node.js to reinstall
npm
- Install Microsoft Studio 2013 (Express Desktop)
在这一点上,我应该能够在Aurelia目录上运行npm install
,但是由于问题描述中指出的错误,我仍然失败.
At this point, I should have been able to run npm install
against the Aurelia directory, however I was still failing due to the error noted in the description of the issue.
-
通过发出以下命令,明确告诉
npm
使用Microsoft Studio 2013:
Explicitly tell
npm
to use Microsoft Studio 2013, by issuing the command:
npm config set msvs_version 2013 --global
现在,在执行此命令之后,我能够成功执行npm install
而没有任何GYP
错误.
Now, subsequent to this command, I was able to successfully execute npm install
without any GYP
errors.
我不知道为什么,但是无论出于什么原因,node-gyp
似乎在2012年都不能很好地发挥作用,因此,如果遇到此问题,我会选择2013年,这里实际上引用了它: https://github.com/nodejs/node-gyp
I don't know why, but for whatever reason node-gyp
doesn't seem to play nice with 2012, so if you're hitting this issue, I'd opt for 2013, which is actually referenced here: https://github.com/nodejs/node-gyp
这篇关于Aurelia npm安装:吨的"gyp ERR"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!