MSB3411无法加载Visual C ++组件

时间:2013-01-17 13:55:51

标签: node.js socket.io

我有MS Visual Studio 2012 Ultimate和OS是Windows 7,并且安装了nodeJ。我想使用npm安装socket.io,但是我收到以下错误。

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)

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

4 个答案:

答案 0 :(得分:13)

很抱歉找到一个旧问题,但你的问题是我搜索“Socket.io VCBuild”时的第一个结果

我在StackOverflow绊倒之后发现的解决方案是:

npm install socket.io --msvs_version=2012

来自@ petf-felzmann的

更新。如果你使用的是VS 2015,你可以使用:

npm install socket.io --msvs_version=2015

答案 1 :(得分:1)

安装dotnet 3.5,因此可以编译websockets

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

答案 2 :(得分:1)

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

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

示例:

  • 为Visual Studio 2012设置GYP_MSVS_VERSION=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安装的一部分发布,这样我们就可以永久修复这个问题。

随时添加您的投票:

答案 3 :(得分:-3)

我想我找到了它。试试:

npm install websocket@1.0.3

我发现它here