Error in installing node.js module using npm

2019-01-23 04:16发布

问题:

I am trying to install the following module using node.js, but keep on getting the following error. 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.

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.

回答1:

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 2012 does the job.



回答2:

You need to add VCBuild.exe to your path. Check out this answer on how to do it: Testacular install fails, no vcbuild.exe



回答3:

npm install -g windows-build-tools

ran in an administration window:

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.


回答4:

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:"

1 - Visual C++ 2010 Express or Visual Studio 2010
2 - Windows SDK 7.1 Note: If you get error on installation, maybe this link will help you.
3 - Visual Studio 2010 SP1
4 - Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1

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



回答5:

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

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



回答6:

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. Restarting the machine didn't resolve the error. I tried starting the app using node app.js and it works!



回答7:

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

will resolve 90% of the install issues in windows for node



标签: node.js npm