nwjs / nw-gyp

native addon build tool for node-webkit
MIT License
195 stars 46 forks source link

Cannot set correct MSBuild path with VS2019 #146

Open mattbhenley opened 3 years ago

mattbhenley commented 3 years ago

I am receiving this error: gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\MSBuild.exe ENOENT

When I check the path in congif.gypi, I see: "msbuild_path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\15.0\\Bin\\MSBuild.exe"

where it should be: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe

I have tried setting the path with the command npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"

I also download visual studio build tools. I saw in a previous post where the user suggested this:

`I've just hit this, too. For those who want a temporary workaround, hand-editing the file configure.js in node-gyp appears to work. I changed line 161 from this:

variables['msbuild_path'] = path.join(vsSetup.path, 'MSBuild', '15.0',

to this:

variables['msbuild_path'] = path.join(vsSetup.path, 'MSBuild', 'Current',

then reran:

node-gyp configure`

BUT when I look at my configure. js on line 161 all I see is variables.msbuild_path = vsInfo.msBuild

I continually get this error. Any help is appreciated!

m4heshd commented 2 years ago

Did you manage to fix this?