TL;DR
Use the Visual Studio Installer to get the Desktop development with C++ workload in one of the Visual Studio versions you have installed in your machine:
Reason/Details
Reading through the log, the main error is due to this:
msvs_version not set from command line or npm config
After this one you find a few of these:
“Visual Studio C++ core features” missing
And later:
You need to install the latest version of Visual Studio including the “Desktop development with C++” workload.
For more information consult the documentation at:
Finally:
Could not find any Visual Studio installation to use
So to solve the problem, you just need to get “Desktop development with C++” workload.
If you have a Visual Studio version installed
- open Visual Studio Installer (Win + search for it)
- on the list displayed with all Visual Studio Installations you have in your PC, press the Modify button of one of them (preferably the latest version)
- on the Workloads grid/list select the checkbox with Desktop development with C++
- Press one of the Install buttons
gyp will then find that version and use it:
gyp info find Python using Python version 3.8.1 found at “C:\Users\USER\AppData\Local\Programs\Python\Python38-32\python.exe”
gyp info find VS using VS2019 (16.4.29709.97) found at:
gyp info find VS “C:\Program Files (x86)\Microsoft Visual Studio\2019\
With NO Visual Studio installed
The following solutions assume you have node installed. Disclaimer: I did not test any of them, but I appreciate everyone that reported them solving this issue.
Alternative 0: before installing additional software
As kaulshapranav wrote in a couple of comments, slightly shortened/rephrased:
windows-build-tools installation log mentions this tools package is deprecated and is already included with node. It corrupts my anaconda installation by installing a separate python 2.7 (…); updating npm version from 6 -> 8 solved the issue.
npm comes with node, so the solution: update your node/npm version. However, if you need to retain specific versions, nvm (notice the v) allows to change between them: simple tutorial on how to use nvm.
Alternative 1
As Hamid Jolany’s answer suggests, on an admin shell, simply install the build tools package globally (node-gyp README):
npm i -g windows-build-tools
Alternative 2
Ragavan’s idea/answer from a similar thread:
- verify if you have VS build tools by running
npm config get msvs_version
(if you have, skip to step 4 and attempt setting the environment variables) - if not installed, get the VS build tools latest version exe and install it (Ragavan’s idea was with or Microsoft Build Tools 2015)
- run
npm config set msvs_version 2019 --global
(ornpm config set msvs_version 2015 --global
according to Ragavan’s idea) - Possibly optional: set the
VCTargetsPath
environment variable (Win + search for var) to the appropriate path (e.g.C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0
) or through Run as Admin terminal, as in Ragavan’s idea with the 2015 Build Tools:set VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140"
- or in Powershell:
$env:VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
Side notes:
- a previous error might be resolved by installing Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019;
- you might also want to restart after installing any of the above