I have installed the latest Visual Studio Build tools 2022 using these instructions:
This is my .npmrc file:
msvs_version=2017
msbuild_path=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
Following the MSBuild.exe I run this file and get:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
The error message when trying to install a package I get is:
Now it gets interesting: running gyp configure I don't get the same error:
I wonder what else can I do? I went trough countless threads and couldn't resolve this issue. I have a machine with windows 10 on, and did the exact same procedure and it works. But here, the path to the build tools can't be found.
CodePudding user response:
According to your screenshot you are using node-gyp 5.1.0, not 9.1.0, which is three years old at this point. So it not finding Visual Studio 2022, which was released last year, isn't unexpected.
You need to update your node-gyp version (or node, since node v14 is also old). If you update to a new version of node the installer will ask you if you want to install the build tools as well which is usually a good idea.
If you however want to upgrade your current node-gyp you can follow these steps, assuming node is installed in C:\Program Files\nodejs\
(taken from the node-gyp docs)
cd "C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script"
npm install node-gyp@latest