node-gyp: gyp ERR! find VS - does not match this Visual Studio Command Prompt

  • Node Version: v18.15.0
  • Platform: Windows 11
  • Compiler: 2022
  • Module: node-gyp
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.15.0 | win32 | x64
gyp info find Python using Python version 3.11.2 found at \"C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python311\\python.exe\"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS running in VS Command Prompt, installation path is:
gyp ERR! find VS \"C:\\Program Files\\Microsoft Visual Studio\\2022\"
gyp ERR! find VS - will only use this version
gyp ERR! find VS checking VS2022 (17.5.33502.453) found at:
gyp ERR! find VS \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\"
gyp ERR! find VS - found \"Visual Studio C++ core features\"
gyp ERR! find VS - found VC++ toolset: v143
gyp ERR! find VS - found Windows SDK: 10.0.22000.0
gyp ERR! find VS - does not match this Visual Studio Command Prompt
gyp ERR! find VS checking VS2017 (15.9.33423.255) found at:
gyp ERR! find VS \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\"
gyp ERR! find VS - found \"Visual Studio C++ core features\"
gyp ERR! find VS - found VC++ toolset: v141
gyp ERR! find VS - found Windows SDK: 10.0.17763.0
gyp ERR! find VS - does not match this Visual Studio Command Prompt
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8

node-gyp: 9.3.1

npm version { npm: ‘9.6.2’, node: ‘18.15.0’, v8: ‘10.2.154.26-node.25’, uv: ‘1.44.2’, zlib: ‘1.2.13’, brotli: ‘1.0.9’, ares: ‘1.18.1’, modules: ‘108’, nghttp2: ‘1.51.0’, napi: ‘8’, llhttp: ‘6.0.10’, uvwasi: ‘0.0.15’, acorn: ‘8.8.2’, simdutf: ‘3.1.0’, undici: ‘5.20.0’, openssl: ‘3.0.8+quic’, cldr: ‘42.0’, icu: ‘72.1’, tz: ‘2022g’, unicode: ‘15.0’, ngtcp2: ‘0.8.1’, nghttp3: ‘0.7.0’ }

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 31 (6 by maintainers)

Most upvoted comments

@a

Yes, it is the latest version but still not working.

try searching for .npmrc files on your computer.

I also did it and tried to add them manually through notepad. I save it and when I reopen it changes are not done.

@A

Yes, it is the latest version but still not working.

try searching for .npmrc files on your computer.

I also did it and tried to add them manually through notepad. I save it and when I reopen it changes are not done.

Same issue with node 18.16.0. I installed node 17.9.1 with nvm, and npm config set command works now. Still figuring out what was the actual issue.

@xXAvoraXx gyp ERR! build error gyp ERR! stack Error: C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\build.js:203:23) gyp ERR! stack at ChildProcess.emit (node:events:513:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12) gyp ERR! System Windows_NT 10.0.19045 gyp ERR! command \"C:\\\\Program Files (x86)\\\\nodejs\\\\node.exe\" \"C:\\\\Program Files (x86)\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"rebuild\"

Here are my errors. I did all your recommendations though. Thanks for your support.

  • Enter the Visual Studio Installer and make sure you have C++ Desktop development installed.
  • Save the following path in Windows environment variables.

variable name: VCINSTALLDIR variable: C:\Program Files\Microsoft Visual Studio\2022\Community\VC

  • I don’t know why npm is not registered your config settings, unfortunately, you can search for ‘npm config edit not saving’ on google.

In new versions of npm the below command doesn’t work anymore so I don’t know if it’s correct I entered the config file and added it.

All of are not working on npm 9.6.2

npm config set msvs-version=2022 npm config set msvs-version 2022 npm config set msvs_version=2022 npm config set msvs_version 2022

npm gives that error when I set. npm ERR! msvs-version is not a valid npm option

I added both parameters by typing npm config edit, now I’m waiting for the results. --> yarn install --loglevel silly

Can you please set both msvs-version and msvs_version to the same value? #2644

“npm config get msvs_version” returns “2022”.

% npm config list -l | grep msvs # Returns zero hits.

https://github.com/nodejs/node-gyp/issues/2803#issuecomment-1728893777

I had the same issue with @electron I solved the problem by setting env variable GYP_MSVS_VERSION=2022