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

我试图安装下面的模块使用node.js,但继续得到以下错误。 你有什么build议我应该做什么? 所以我使用的是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. 

最简单的方法是安装Visual Studio的试用版,并以pipe理员身份在Visual Studio命令提示符下运行npm。 Visual Studio 2012完成这项工作。

您需要将VCBuild.exe添加到您的path。 看看这个答案如何做到: Testacular安装失败,没有vcbuild.exe

这个步骤帮了我很多:

“根据Windows SDK 7.1的Microsoft Visual C ++ 2010 Service Pack 1编译器更新中的自述文件,为确保您的系统具有支持的configuration,请卸载以下产品,然后按所列顺序重新安装它们:

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编译器更新

对我来说,只有第二步就够了。 请注意第二步的注意事项“注意:如果您在安装时遇到错误,也许这个链接将帮助您”。 我有问题,这个提示很重要。

欲了解更多信息,这个链接可以是有用的: https : //github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup

在尝试了各种.Net和Visual之后,我最终设法通过下载Visual Studio 2013 Prof来获取npm来加载和在Windows 8.1上构buildmongoose

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

有趣的是,即使在安装Visual Studio 2015并将VCBuild.exe的path添加到环境variables – > PATH后,当我试图npm install时,发生了这个错误。 重新启动机器不能解决错误。 我尝试使用node app.js启动应用程序,它的工作原理!