Cannot install node modules that require compilation on Windows 7 x64/VS2012

Solution 1:

Try that - will set it globally:

npm config set msvs_version 2012 --global

Solution 2:

To do it without VS2010 installation, and only 2012, set the msvs_version flag:

node-gyp rebuild --msvs_version=2012

npm install <module> --msvs_version=2012

as per @Jacob comment

npm install --msvs_version=2013 if you have the 2013 version

Solution 3:

Update v3: https://www.npmjs.com/package/windows-build-tools

npm install --global windows-build-tools

downloads and installs Visual C++ Build Tools 2015, provided free of charge by Microsoft. These tools are required to compile popular native modules. It will also install Python 2.7, configuring your machine and npm appropriately.

Update v2:

node-gyp updated their readme to include HOW-TO for windows

Original:

No need for the entire visual studio, you can download just the build tools

Microsoft Build Tools 2013 : http://www.microsoft.com/en-us/download/details.aspx?id=40760

run cmd to set global flag to use the 2013 version:

npm config set msvs_version 2013 --global

after this everything should be back to normal and your npm install / node-gyp rebuild will work

Solution 4:

just add --msvs_version=2012

node-gyp rebuild --msvs_version=2012

or

node-gyp configure --msvs_version=2012
node-gyp build