MSBUILD Tools error with npm install

I am trying to run npm install on an Angular app. The earliest error with any useful information is:
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0"
Then there is a long and detailed list of errors from npm gyp, the first in which MSBUILD is mentioned is:
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
Then
gyp info spawn args 'build/binding.sln'
and then
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
I have tried running
npm install --global --production windows-build-tools
npm install --global --production windows-build-tools
as advised by a colleague and StackOverflow but that command just hangs. I understand it's a large package to download but it hung for 4 or 5 hours. Then I tried
choco install vcbuildtools
choco install vcbuildtools
but that exits with a "Generic MSI Error". What more can I do to solve or at least diagnose this error?
9 Replies
Brady Kelly
Brady KellyOP3y ago
Yes, I have just tried npm config set msvs_version 2022 --global and am waiting for npm install to finish again
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Brady Kelly
Brady KellyOP3y ago
I can't change the way these command are invoked, it's all done my npm-gyp, but thanks for the info on the MSBUILD path, I have seen a way to set that for gyp somewhere
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Brady Kelly
Brady KellyOP3y ago
Oh, it's running in PowerrShell. I've found a promising solution though, to update to the latest version of gyp
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Brady Kelly
Brady KellyOP3y ago
After some struggling it is using the VS 2022 dev tool, but now it has a build error.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Brady Kelly
Brady KellyOP3y ago
It's a big improvement. Now I must just find the source file cited as causing the build error. Thanks for all the help, I'm gonna close this ticket and open a more on topic one if I need help again

Did you find this page helpful?