Ask questionsBreaks with VS2019 installed

node-gyp version 4.0.0 I have vs2015, vs2017 and vs2019 installed, I need them for different projects so uninstalling one isn't really an option.

As far as I can tell, if I use msvs_version=2017, the autodetection now finds the setup for 2019 and then fails to construct the correct path for msbuild which is now at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe instead of C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe as node-gyp seems to expect.

Now I'm fine with running the proper 2017 or 2019 and overwriting the msbuild path, doesn't really matter to me, but I can't find how to configure either. I can apparently overwrite the msbuild path with the command line "--msbuild_path" and thus use vs2019 but the same parameter set globally through "npm config" seems to have no effect. Any hints?


Answer questions Vultraz

Can confirm this setup works

msbuild_path = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"
msvs_version = "2017"

(set with npm config)

Using npm config set msvs_version 2019 causes its own problems:

Traceback (most recent call last):
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\", line 16, in <module>
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\", line 538, in main
    return gyp_main(args)
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\", line 514, in gyp_main
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\", line 98, in Load
    generator.CalculateVariables(default_variables, params)
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\", line 1916, in CalculateVariables
    generator_flags.get('msvs_version', 'auto'))
  File "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\", line 434, in SelectVisualStudioVersion
    versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2019'

Related questions

Error: `gyp` failed with exit code: 1 at ChildProcess.onCpExit hot 4
gyp ERR! stack Error: `make` failed with exit code: 2 hot 2
npm install error on windows 10 hot 2
Fails on every npm install on macOS Mojave hot 2
node-gyp: EPERM: operation not permitted, read hot 2
Visual Studio finder is doing a case-sensitive path check hot 2
node-gyp rebuild failed hot 1
Node gyp build fails on node v12.1.0 hot 1
node-pre-gyp build fail error while installing with `npm install` or `npm install -d` hot 1
Is this an Issue with MACOS catalina? hot 1
gyp ERR! stack Error: `make` failed with exit code: 2 hot 1
Is this an Issue with MACOS catalina? hot 1
Is this an Issue with MACOS catalina? hot 1
Not able to build in osx 10.14.2 with java 10.0.1 hot 1
TypeError: '>=' not supported between instances of 'tuple' and 'str' hot 1
Github User Rank List