MSB3411 Could not load Visual C++ component

匿名 (未验证) 提交于 2019-12-03 02:57:02

问题:

I have MS Visual Studio 2012 Ultimate and OS is Windows 7, and have nodeJs installed.I wanted to install socket.io using npm,but I get the following error.

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) 

What might be the issue?How can I fix it?

回答1:

Sorry to dig up an old question, but your question is the first result when I searched for "Socket.io VCBuild"

The solution I found, after stumbling around on StackOverflow was:

npm install socket.io --msvs_version=2012

Update from @petf-felzmann. If you're using VS 2015 you can use:

npm install socket.io --msvs_version=2015



回答2:

Install dotnet 3.5, so the websockets may be compiled

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



回答3:

Make sure you have all the pre-requisite software to run node-gyp:

You can configure version of Visual Studio used by gyp via an environment variable so you can avoid having to set the --msvs_version=2012 property.

Examples:

  • set GYP_MSVS_VERSION=2012 for Visual Studio 2012
  • set GYP_MSVS_VERSION=2013e (the 'e' stands for 'express edition')

For the full list see - https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

This is still painful for Windows users of NodeJS as it assumes you have a copy of Visual Studio installed and many end users will never have this. So I'm lobbying Joyent to the encourage them to include web sockets as part of CORE node and also to possible ship a GNU gcc compiler as part of NodeJS install so we can permanently fix this problem.

Feel free to add your vote at:



回答4:

I think I found it. Try:

npm install websocket@1.0.3 

I found it here



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!