Npm for some packages (sqlite3, socket.io) with error MSB8020 on Windows 7

When I tried to install some node.js packages (specifically sqlite3 and socket.io) using npm install socket.io on my Windows 7 computer with Visual Studio 2012 (and not in 2010), I had some glitches that looked in the following way:

C: \ Program Files (X86) \ MSBuild \ Microsoft.Cpp \ v4.0 \ V110 \ Microsoft.Cpp.Platform.targets (35.5): Error MSB8020: build tools for Visual Studio 2010 (Toolset = 'v100' platform ) cannot be found. To build tools using the v100 assembly, either click the Project menu, or right-click it, and then select Update VC ++ Projects .... Install Visual Studio 2010 on using the Visual Studio 2010 build tools.

+46
npm visual-studio-2012 sqlite3
Jan 6 '13 at 6:44
source share
4 answers

To get around this on my computer, I ran this command to install the package:

npm install socket.io --msvs_version=2012

I found the answer here when there was a problem installing sqlite3, and it also worked with socket.io.

These may be more permanent solutions to fix the problem:

  • Install Visual Studio 2010
  • Updating the internal copy of npm in a newer version of node -gyp, as described here and here (perhaps the best option, although I did not get it, but did not try for too long)
+82
Jan 6 '13 at 6:44
source share

Another option is to change the configuration, and not specify msvs_version every time:

 npm config set msvs_version 2012 
+75
Mar 01 '14 at 22:03
source share

I have installed both Visual Studio Express 2013 and Visual Studio Community 2015.

I was getting C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...". [G:\work\cinema\node_modules\engine.io\node_modules\bufferutil\build\bufferutil.vcxproj] C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...". [G:\work\cinema\node_modules\engine.io\node_modules\bufferutil\build\bufferutil.vcxproj]

The reason was that the latest Node.js for Windows, downloaded from https://nodejs.org , contains the old npm v2 (and the old node-gyp inside npm v2).

I had to update Node.js'es internal npm (which also updated node-gyp ):

 (open console as an administrator) cd "C:\Program Files\nodejs" npm install npm@latest npm config set msvs_version 2013 

Now it works (it seems that it is using VS 2013 currently)

+2
Oct 16 '15 at 21:15
source share

TL; DR

If you DO NOT want to want node-gyp depend on the installed version of Visual Studio (or do not install VS), install windows-build-tools (see below). This will fix the error and avoid future problems when updating the installed version of Visual Studio.

If you DO want node-gyp depend on the version of Visual Studio you have installed, then npm config set msvs_version 2015 instead of the 2015 tag, replace your version tag. Valid version tags: 2015 , 2014 , 2013 , 110 , 100




Commit using windows-build-tools

In node-gyp instructions you can also do

npm install --global --production windows-build-tools from the ELEVATED command line

This will install strictly the Microsoft Visual C ++ Build Tools (this will be used instead of Visual Studio for compilation) required by node-gyp , and set msvs_version only for the version installed.

After installation, you should verify that the msvs_version parameter set by windows-build-tools not been overridden. When running npm config list , msvs_version should appear under ; globalconfig C:\Users\Username\AppData\Roaming\npm\etc\npmrc ; globalconfig C:\Users\Username\AppData\Roaming\npm\etc\npmrc ; if it is not, the value set by windows-build-tools been overridden, and the overridden value should be removed. npm config delete msvs_version should delete the overridden value, and the value set by the build tools should appear in the global configuration section.

0
Oct 29 '16 at 18:02
source share



All Articles