How to fix node-gyp rebuild errors on windows

Posted by Damodar Bashyal on March 30, 2016

 

I was trying to install node module printer "npm install printer" and got few errors while trying few solutions that I found in different blogs, forums and stackoverflow sites.

I would like to share what worked for me at the end.

[] Uninstall all Microsoft Visual C++ except the latest one.

I have installed 2015 - https://www.microsoft.com/en-us/download/details.aspx?id=49983 (Microsoft Visual C++ Build Tools 2015 Technical Preview)

Microsoft Visual C++ Build Tools 2015 Technical Preview

npm config set msvs_version 2015 --global

[] Install Python version < 3.0.

I have Python 2.7.11 installed at C:\Python27 and added to windows path.

https://www.python.org/downloads/release/python-2711/

npm config set python python2.7 --global
npm config set python C:\Python27\python.exe --global

If you have windows 32 bit machine, run this:

set VCTargetsPath=C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\v140

If you have windows 64 bit machine, run this:

set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140

After those steps I opened new CMD window and run "npm install printer --save" and it installed perfectly this time.

npm install printer --save

[] Some of the errors I was getting were:

1.

https://github.com/tojocky/node-printer/issues/121

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.  [C:\_projects\node projects\printer\node_modules\printer\build\binding.sln] gyp ERR! build error

2.

vcbuild.exe : error VCBLD0010: Project 'C:\_projects\node projects\printtest\node_modules\printer\build\node_printer.vcproj' requires upgrade. Use 'vcbuild /upgrade' or 'devenv /upgrade' to upgrade the project.

3.

vcbuild.exe : error VCBLD0010: Project 'config' requires upgrade. Use 'vcbuild /upgrade' or 'devenv /upgrade' to upgrade the project.

4.

npm ERR! [email protected] install: 'node-gyp rebuild'npm ERR! Exit status 1npm ERR!npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.npm ERR! Make sure you have the latest version of node.js and npm installed.npm ERR! If you do, this is most likely a problem with the printer package,npm ERR! not with npm itself.npm ERR! Tell the author that this fails on your system:npm ERR!     node-gyp rebuildnpm ERR! You can get information on how to open an issue for this project with:npm ERR!     npm bugs printernpm ERR! Or if that isn't available, you can get their info via:npm ERR!     npm owner ls printernpm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:npm ERR!     C:\_projects\node projects\printtest\npm-debug.log

References:

Check these urls for more ideas:

1> https://github.com/tojocky/node-printer/issues/121

2> https://github.com/nodejs/node-gyp/issues/629#issuecomment-197413477

3> https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/

4> http://stackoverflow.com/questions/14278417/cannot-install-node-modules-that-require-compilation-on-windows-7-x64-vs2012

swathi posted on - Wednesday 31st of May 2017 12:50:38 AM

i want to include angular controller in node js and node js files are used in angular controller is there any possibility.
 
not published on website


QR Code: How to fix node-gyp rebuild errors on windows