MSB3411无法加载Visual C ++组件

我有MS Visual Studio 2012旗舰版和操作系统是Windows 7,并已安装nodeJs。我想要安装socket.io使用npm,但我得到以下错误。

C:\Users\NEW>npm install socket.io npm http GET https://registry.npmjs.org/socket.io npm http 304 https://registry.npmjs.org/socket.io npm http GET https://registry.npmjs.org/socket.io-client/0.9.11 npm http GET https://registry.npmjs.org/policyfile/0.0.4 npm http GET https://registry.npmjs.org/base64id/0.1.0 npm http GET https://registry.npmjs.org/redis/0.7.3 npm http 304 https://registry.npmjs.org/socket.io-client/0.9.11 npm http 304 https://registry.npmjs.org/base64id/0.1.0 npm http 304 https://registry.npmjs.org/policyfile/0.0.4 npm http 304 https://registry.npmjs.org/redis/0.7.3 npm http GET https://registry.npmjs.org/uglify-js/1.2.5 npm http GET https://registry.npmjs.org/ws npm http GET https://registry.npmjs.org/xmlhttprequest/1.4.2 npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1 npm http 304 https://registry.npmjs.org/ws npm http 304 https://registry.npmjs.org/xmlhttprequest/1.4.2 npm http 304 https://registry.npmjs.org/uglify-js/1.2.5 npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1 npm http GET https://registry.npmjs.org/zeparser/0.0.5 npm http GET https://registry.npmjs.org/tinycolor npm http GET https://registry.npmjs.org/commander npm http GET https://registry.npmjs.org/options npm http 304 https://registry.npmjs.org/zeparser/0.0.5 npm http 304 https://registry.npmjs.org/commander npm http 304 https://registry.npmjs.org/tinycolor npm http 304 https://registry.npmjs.org/options > ws@0.4.25 install C:\Users\NEW\node_modules\socket.io\node_modules\socket.io-c lient\node_modules\ws > (node-gyp rebuild 2> builderror.log) || (exit 0) C:\Users\NEW\node_modules\socket.io\node_modules\socket.io-client\node_modules\w s>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo dules\node-gyp\bin\node-gyp.js" rebuild Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual Studio 2008. [C:\Users\NEW\node_modules\socket.io\node_modules\socket.io-clie nt\node_modules\ws\build\binding.sln] MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual Studio 2008. [C:\Users\NEW\node_modules\socket.io\node_modules\socket.io-clie nt\node_modules\ws\build\binding.sln] socket.io@0.9.13 node_modules\socket.io ├── base64id@0.1.0 ├── policyfile@0.0.4 ├── redis@0.7.3 └── socket.io-client@0.9.11 (xmlhttprequest@1.4.2, uglify-js@1.2.5, active-x-obf uscator@0.0.1, ws@0.4.25) 

可能是什么问题?我该如何解决?

抱歉挖一个老问题,但你的问题是我search“Socket.io VCBuild”时的第一个结果

我发现在StackOverflow上遇到的解决scheme是:

npm install socket.io --msvs_version=2012

从@ petf-felzmann 更新 。 如果你使用VS 2015,你可以使用:

npm install socket.io --msvs_version=2015

安装dotnet 3.5,所以可以编译websocket

http://www.microsoft.com/en-us/download/details.aspx?id=21

确保您拥有运行node-gyp所有必备软件:

您可以通过环境variablesconfiguration--msvs_version=2012使用的Visual Studio版本,这样您就可以避免设置--msvs_version=2012属性。

例子:

  • 为Visual Studio 2012设置GYP_MSVS_VERSION=2012 2012
  • 设置GYP_MSVS_VERSION=2013e ('e'代表'express edition')

有关完整列表,请参阅 – https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

对于NodeJS的Windows用户来说,这仍然很痛苦,因为它假定你已经安装了Visual Studio的副本,许多最终用户永远不会拥有这个。 所以我正在向Joyent游说,鼓励他们将Web套接字作为CORE节点的一部分,同时也可能将GNU gcc编译器作为NodeJS安装的一部分,以便我们可以永久解决这个问题。

随时添加您的投票在:

我想我find了。 尝试:

 npm install websocket@1.0.3 

我在这里find了