Skip to content

Instantly share code, notes, and snippets.

@Nigtellios
Last active August 14, 2023 20:23
Show Gist options
  • Save Nigtellios/3ce9832e0140f0a321494fceb405f800 to your computer and use it in GitHub Desktop.
Save Nigtellios/3ce9832e0140f0a321494fceb405f800 to your computer and use it in GitHub Desktop.
Node-gyp error fix on Windows 11 (does not match this Visual Studio Command Prompt)

If you're getting the following error:

npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./scripts/install.js || node-gyp rebuild
npm ERR! info install installing standalone, skipping download.
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS running in VS Command Prompt, installation path is:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC"
npm ERR! gyp ERR! find VS - will only use this version
npm ERR! gyp ERR! find VS checking VS2022 (17.7.34003.232) found at:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v143
npm ERR! gyp ERR! find VS - found Windows SDK: 10.0.20348.0
npm ERR! gyp ERR! find VS - does not match this Visual Studio Command Prompt
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
npm ERR! gyp ERR! find VS - could not find MSBuild in registry for this version
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
  1. Install Latest Visual Studio 2022/newer with "C++ Desktop developmnet" workload.
  2. Open Windows Terminal.
  3. From dropdown in Tabs select "Developer Command Prompt For VS 2022" (2022 can be higher).
  4. Run command set.
  5. Find Path.
  6. Copy whole content of Path.
  7. Run command setx /M path "%path%;C:\your\path\here\" and put previously copied "Path" content into C:\your\path\here\.

Please note that setx command has a character limit of 1024. There are actually a lot of ways to exceed the PATH limit, including using PS1 scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment