Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hk-aurus opened this issue Jan 4, 2024 · 5 comments
Labels

Comments

@hk-aurus
Copy link

hk-aurus commented Jan 4, 2024

I am getting following error

gyp info it worked if it ends with ok
gyp info using node-gyp@8.1.0
gyp info using node@16.20.2 | 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?

@MeridianGH
Copy link

MeridianGH commented Jan 21, 2024

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.

@cfficaurzua
Copy link

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

@cclauss
Copy link
Contributor

cclauss commented Feb 5, 2024

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.

@huseyinacacak-janea
Copy link
Contributor

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

@StefanStojanovic
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants