使用 npm 安装 node.js 模块时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17496189/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error in installing node.js module using npm
提问by anonymous123
I am trying to install the following module using node.js, but keep on getting the following error. Do you have any suggestions on what I should do? So I am using windows 7 and have installed .NET Framework 2.0 SDK as well.
我正在尝试使用 node.js 安装以下模块,但不断收到以下错误。你对我应该做什么有什么建议吗?所以我使用的是 Windows 7 并安装了 .NET Framework 2.0 SDK。
npm install execSync
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
To fix this, 1) install the .NET Framework 2.0 SDK,
2) install Microsoft Visual Studio 2005 or
3) add the location of the component to the system path if it is installed elsewhere.
采纳答案by Jean-Philippe Leclerc
The easiest way is to install a trial version of visual studio and run npm in the visual studio command prompt as administrator. Visual studio 2012 does the job.
最简单的方法是安装 Visual Studio 的试用版,并以管理员身份在 Visual Studio 命令提示符下运行 npm。Visual Studio 2012 可以完成这项工作。
回答by verybadalloc
You need to add VCBuild.exeto your path. Check out this answer on how to do it: Testacular install fails, no vcbuild.exe
您需要添加VCBuild.exe到您的路径中。查看有关如何操作的答案:Testacular install failed, no vcbuild.exe
回答by Eka putra
npm install -g windows-build-tools
ran in an administration window and we will see:
在管理窗口中运行,我们将看到:
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Waiting for installers... -Successfully installed Python 2.7
Waiting for installers... /Successfully installed Visual Studio Build Tools.
回答by S Rekhu
npm install --global --production windows-build-tools
will resolve 90% of the install issues in windows for node
将解决 Windows 中 90% 的节点安装问题
回答by Gustavo de Geus
This steps helped me a lot:
这些步骤对我帮助很大:
"According to the readme file in Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1, to ensure that your system has a supported configuration, uninstall the following products and then reinstall them in the order listed:"
“根据 Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1 中的自述文件,为确保您的系统具有受支持的配置,请卸载以下产品,然后按所列顺序重新安装它们:”
1 - Visual C++ 2010 Express or Visual Studio 2010
2 - Windows SDK 7.1 Note: If you get error on installation, maybe this link will help you.
3 - Visual Studio 2010 SP1
4 - Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
1 - Visual C++ 2010 Express 或 Visual Studio 2010
2 - Windows SDK 7.1注意:如果您在安装时遇到错误,也许此链接会对您有所帮助。
3 - Visual Studio 2010 SP1
4 - Windows SDK 7.1 的 Visual C++ 2010 SP1 编译器更新
For me, only the step two was enough. Pay attention in second step's note "Note: If you get error on installation, maybe this link will help you". I had problem and this tip was important.
对我来说,只有第二步就足够了。请注意第二步的注释“注意:如果您在安装时出错,也许此链接会对您有所帮助”。我遇到了问题,这个提示很重要。
For more information, this link can be useful: https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup
有关更多信息,此链接可能很有用:https: //github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup
回答by Trevor Hutt
After trying various .Net and Visual I finally managed to get npm to load and build mongoose on Windows 8.1 by downloading Visual Studio 2013 Prof
在尝试了各种 .Net 和 Visual 之后,我终于通过下载 Visual Studio 2013 Prof,设法让 npm 在 Windows 8.1 上加载和构建猫鼬
回答by Vinay Vemula
Interestingly, even after installing Visual Studio 2015 and adding the path to VCBuild.exe to Environment Variables -> PATH, this error was occuring when i tried to npm install. Restarting the machine didn't resolve the error. I tried starting the app using node app.jsand it works!
有趣的是,即使在安装 Visual Studio 2015 并将 VCBuild.exe 的路径添加到环境变量 -> PATH 之后,当我尝试npm install. 重新启动机器没有解决错误。我尝试使用启动该应用程序node app.js并且它有效!
回答by Daniyal
This command will add necessary packages.
此命令将添加必要的包。
npm install --global --production windows-build-tools
npm install --global --production windows-build-tools

