node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"

Open hk-aurus opened this issue 1 year ago • 3 comments

I am getting following error

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.10.0 found at "C:\Users\harip\AppData\Local\Programs\Python\Python310\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2022
gyp ERR! find VS running in VS Command Prompt, installation path is:
gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
gyp ERR! find VS - will only use this version
gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
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
gyp ERR! find VS msvs_version does not match this VS Command Prompt or the
gyp ERR! find VS installation cannot be used.
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error

Initially there were issue related to [gyp ERR! find VS find VS msvs_version not set from command line or npm config?]

So tried following commands and other options to resolve it,
 
>npm config set msvs_version 2022 --global
>npm config set msbuild_path "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"
>yarn install --global --production windows-build-tools

Downloaded and installed the microsoft build tools with Desktop development with C++.
tried setting the environment variable for VCINSTALLDIR to "C:\Program Files\Microsoft Visual Studio\2022\Community\VC"

But still there are errors mentioned as above what could be the solution to this?

hk-aurus avatar Jan 04 '24 10:01 hk-aurus

I'm getting the same error when trying to install dependencies for a large project.

I tried the same steps as you did to no avail as well.

Interestingly enough, I tried simply running the command MSBuild in command prompt and recieved an error as well. I then set C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin in my PATH environment variable. The command works now in command prompt and PowerShell, but installing dependencies with yarn does not.

So basically +1. Looking forward to hearing ideas to fix this.

EDIT: According to this StackOverflow answer running yarn with Node v14 installed works. I tried switching to v14.21.3 with nvm and it indeed worked fine.

MeridianGH avatar Jan 21 '24 17:01 MeridianGH

it doesn't worked for me with node 14 i have the path set correctly

cfficaurzua avatar Feb 05 '24 18:02 cfficaurzua

npm config set msvs_version 2022 --global

Try npm config ls -l | grep msvs to see if npm supports that setting.

Also, try npm config list to see npm's current settings.

cclauss avatar Feb 05 '24 20:02 cclauss

VS2022 support was added in v8.4.0. The version you are using was not supported. Please try with the newer version.

huseyinacacak-janea avatar Apr 19 '24 12:04 huseyinacacak-janea

Closing this issue, since the version of node-gyp used doesn't even support VS2022.

StefanStojanovic avatar Apr 23 '24 13:04 StefanStojanovic