While running an npm install
that required a node-gyp rebuild, the following build error was thrown:
MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, please install v120 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 "Retarget solution"
Use the msvs_version param: npm install --msvs_version=2015
If the msvs_version param doesn't work, it's probably because you don't have a Visual C++ 2015 build environment installed.
As an alternative to VS2015, you can install the Visual C++ Build Tools 2015 released by Microsoft:
Now that a Visual C++ 2015 build environment has been installed, you can tell npm to use it via the msvs_version param:
npm install --msvs_version=2015
Optionally, instead of specifying the msvs_version at the command prompt, you can configure npm to always include the msvs_version param by adding it to your npmrc or package.json:
npmrc
Open PowerShell and run npm config set msvs_version 2015
, which will add this param to your user npmrc file. Henceforth, every time you run npm install
, as this user, the msvs_version=2015
param will automatically be included
optionally, you can include the global flag
npm config set msvs_version 2015 --global
if you plan on logging in with different Windows accounts, and you want this setting to apply to all accounts on the machine
package.json
Modify your project's package.json file to include:
"config": {
"msvs_version": 2015
}
Henceforth, every time you run npm install
, for this project, the msvs_version=2015
param will automatically be included
Article Revisions