TL;DR
If you DON'T want node-gyp
to depend on your installed version of Visual Studio (or don't have VS installed), install windows-build-tools
(see below). This will eliminate both the error and should avoid future issues when upgrading your installed version of Visual Studio.
If you DO want node-gyp
to depend on your installed version of Visual Studio, then npm config set msvs_version 2015
, substitute your version tag in place of 2015
. Valid versions tags are: 2015
,2014
,2013
,110
,100
Fixing using windows-build-tools
Per the node-gyp installation instructions, you can also do
npm install --global --production windows-build-tools
from an ELEVATED command shell
This will install the strictly the Microsoft Visual C++ Build Tools (this will be used in place of Visual Studio for compilation) required by node-gyp
, and appropriately set msvs_version
to the version just installed.
After installing, you should check that the msvs_version
set by windows-build-tools
has not been overridden. When executing npm config list
, msvs_version
should appear under ; globalconfig C:\Users\Username\AppData\Roaming\npm\etc\npmrc
; if it does not, the value set by windows-build-tools
has been overridden and the overridden value should be deleted. npm config delete msvs_version
should delete the overridden value and the one set by the build tools should appear under the global config section.