简体   繁体   English

使用npm安装node.js模块时出错

[英]Error in installing node.js module using npm

I am trying to install the following module using node.js, but keep on getting the following error. 我正在尝试使用node.js安装以下模块,但继续出现以下错误。 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. 因此,我使用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.

You need to add VCBuild.exe to your path. 您需要将VCBuild.exe添加到您的路径。 Check out this answer on how to do it: Testacular install fails, no vcbuild.exe 查看有关此操作的答案: Testacular安装失败,没有vcbuild.exe

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试用版,并以管理员身份在Visual Studio命令提示符下运行npm。 Visual studio 2012 does the job. Visual Studio 2012可以完成这项工作。

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.

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:" “根据用于Windows SDK 7.1的Microsoft Visual C ++ 2010 Service Pack 1编译器更新中的自述文件,要确保您的系统具有受支持的配置,请卸载以下产品,然后按照列出的顺序重新安装它们:”

1 - Visual C++ 2010 Express or Visual Studio 2010 1-Visual C ++ 2010 Express或Visual Studio 2010
2 - Windows SDK 7.1 Note: If you get error on installation, maybe this link will help you. 2-Windows SDK 7.1 注意:如果安装时出现错误,也许此链接会为您提供帮助。
3 - Visual Studio 2010 SP1 3-Visual Studio 2010 SP1
4 - Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1 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

 npm install --global --production windows-build-tools

将解决Windows中90%的节点安装问题

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上加载和构建猫鼬。

ftp://ftp.microsoft.com/bussys/winsock/winsock2/qos.h ftp://ftp.microsoft.com/bussys/winsock/winsock2/qos.h

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 . 有趣的是,即使在安装Visual Studio 2015并将VCBuild.exe的路径添加到环境变量-> PATH之后,当我尝试进行npm install时也会发生此错误。 Restarting the machine didn't resolve the error. 重新启动计算机无法解决该错误。 I tried starting the app using node app.js and it works! 我尝试使用node app.js启动该应用程序,并且有效!

此命令将添加必要的软件包。

npm install --global --production windows-build-tools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM