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

Visual Studio 2022 Preview - stack Error: Could not find any Visual Studio installation to use #2462

Closed
raverecursion opened this issue Jul 24, 2021 · 11 comments
Labels
ffi-napi Node Sass --> Dart Sass https:/sass/node-sass/issues/2952 Windows

Comments

@raverecursion
Copy link

raverecursion commented Jul 24, 2021

  • Node Version: v15.3.0
  • Platform: /C:"System Type"` (Windows)
  • Compiler:
  • Module: node-sass

12094 error gyp verb find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Preview"

Verbose output (from npm or node-gyp):
12094 error gyp verb build dir attempting to create "build" dir: D:\Project\FashionOrb\client\node_modules\node-sass\build
12094 error gyp verb build dir "build" dir needed to be created? D:\Project\FashionOrb\client\node_modules\node-sass\build
12094 error gyp verb find VS msvs_version was set from command line or npm config
12094 error gyp verb find VS - looking for Visual Studio version 2017
12094 error gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
12094 error gyp verb find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Preview"
12094 error gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
12094 error gyp verb find VS looking for Visual Studio 2015
12094 error gyp verb find VS - not found
12094 error gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
12094 error gyp ERR! find VS
12094 error gyp ERR! find VS msvs_version was set from command line or npm config
12094 error gyp ERR! find VS - looking for Visual Studio version 2017
12094 error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
12094 error gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Preview"
12094 error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
12094 error gyp ERR! find VS looking for Visual Studio 2015
12094 error gyp ERR! find VS - not found
12094 error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
12094 error gyp ERR! find VS
12094 error gyp ERR! find VS valid versions for msvs_version:
12094 error gyp ERR! find VS
12094 error gyp ERR! find VS **************************************************************
12094 error gyp ERR! find VS You need to install the latest version of Visual Studio
12094 error gyp ERR! find VS including the "Desktop development with C++" workload.
12094 error gyp ERR! find VS For more information consult the documentation at:
12094 error gyp ERR! find VS https:/nodejs/node-gyp#on-windows
12094 error gyp ERR! find VS **************************************************************
12094 error gyp ERR! find VS
12094 error gyp ERR! configure error
12094 error gyp ERR! stack Error: Could not find any Visual Studio installation to use
12094 error gyp ERR! stack     at VisualStudioFinder.fail (D:\Project\FashionOrb\client\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
12094 error gyp ERR! stack     at D:\Project\FashionOrb\client\node_modules\node-gyp\lib\find-visualstudio.js:74:16
12094 error gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (D:\Project\FashionOrb\client\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
12094 error gyp ERR! stack     at D:\Project\FashionOrb\client\node_modules\node-gyp\lib\find-visualstudio.js:70:14
12094 error gyp ERR! stack     at D:\Project\FashionOrb\client\node_modules\node-gyp\lib\find-visualstudio.js:372:16
12094 error gyp ERR! stack     at D:\Project\FashionOrb\client\node_modules\node-gyp\lib\util.js:54:7
12094 error gyp ERR! stack     at D:\Project\FashionOrb\client\node_modules\node-gyp\lib\util.js:33:16
12094 error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:316:5)
12094 error gyp ERR! stack     at ChildProcess.emit (node:events:376:20)
12094 error gyp ERR! stack     at maybeClose (node:internal/child_process:1055:16)
12094 error gyp ERR! System Windows_NT 10.0.22000
12094 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Project\\FashionOrb\\client\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
12094 error gyp ERR! cwd D:\Project\FashionOrb\client\node_modules\node-sass
12094 error gyp ERR! node -v v15.3.0
12094 error gyp ERR! node-gyp -v v7.1.2
12094 error gyp ERR! not ok
12094 error Build failed with error code: 1
12095 verbose exit 1
@cclauss cclauss added the Node Sass --> Dart Sass https:/sass/node-sass/issues/2952 label Jul 24, 2021
@cclauss
Copy link
Contributor

cclauss commented Jul 24, 2021

Node-sass is deprecated so we can not support it with a preview version of MSVS.

@cclauss cclauss closed this as completed Jul 24, 2021
@blattersturm
Copy link

This doesn't only happen with 'node-sass', it happens with any node-gyp module. I don't get why this is closed.

@cclauss
Copy link
Contributor

cclauss commented Sep 3, 2021

@blattersturm Please provide the command that was typed and the full error log.

@blattersturm
Copy link

The same portion from the error log above applies, this e.g. also happens when trying to run npm i ffi-napi with only VS2022 installed:

12094 error gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
12094 error gyp verb find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Preview"
12094 error gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
12094 error gyp verb find VS looking for Visual Studio 2015
12094 error gyp verb find VS - not found
12094 error gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8

Some code here hardcodes checks for 2019 when checking for MSBuild path:

if (versionYear === 2019) {

... though the bundled gyp also seems unaware of any newer version:

Should this not fall back to pretending to be the version before if a newer one is installed?

@cclauss
Copy link
Contributor

cclauss commented Sep 3, 2021

I believe that was fixed in gyp-next v0.10.0 https:/nodejs/gyp-next/blob/main/CHANGELOG.md

@aleksey-hoffman
Copy link

@cclauss the issue should probably be re-opened:

VS Studio: 2022 (all build tools and C++ workloads are inistalled)

>node-gyp
v8.2.0
>node-gyp configure

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.9.6 found at "C:\Python39\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Preview"
gyp ERR! find VS unknown version "undefined" found at "C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview"
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
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:/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************

@liudonghua123
Copy link

I have the same problems. When I add --loglevel silly options to npm install and I found the key errors belows:

npm ERR! gyp verb find VS msvs_version was set from command line or npm config
npm ERR! gyp verb find VS - looking for Visual Studio version 2022
npm ERR! gyp verb find VS running in VS Command Prompt, installation path is:
npm ERR! gyp verb find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp verb find VS - will only use this version
npm ERR! gyp sill find VS Running C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [
npm ERR! gyp sill find VS   '-ExecutionPolicy',
npm ERR! gyp sill find VS   'Unrestricted',
npm ERR! gyp sill find VS   '-NoProfile',
npm ERR! gyp sill find VS   '-Command',
npm ERR! gyp sill find VS   "&{Add-Type -Path 'C:\\Users\\Liu.D.H\\AppData\\Roaming\\nvm\\v16.13.0\\node_modules\\npm\\node_modules\\node-gyp\\lib\\Find-VisualStudio.cs';[VisualStudioConfiguration.Main]::PrintJson()}"
npm ERR! gyp sill find VS ]
npm ERR! gyp sill find VS PS stderr = ""
npm ERR! gyp sill find VS processing installation: "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp sill find VS - version match = ["17.0.31903.59","17","0"]
npm ERR! gyp sill find VS - unsupported version: 17
npm ERR! gyp sill find VS - found VC.Tools.x86.x64
npm ERR! gyp sill find VS - invalid versionYear: undefined
npm ERR! gyp sill find VS - found Win10SDK: 19041
npm ERR! gyp sill find VS vsInfo: [
npm ERR! gyp sill find VS   {
npm ERR! gyp sill find VS     path: 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community',
npm ERR! gyp sill find VS     msBuild: null,
npm ERR! gyp sill find VS     toolset: null,
npm ERR! gyp sill find VS     sdk: '10.0.19041.0'
npm ERR! gyp sill find VS   }
npm ERR! gyp sill find VS ]

And finally I found the npm was 8.1.0 which the bundled node-gyp is 8.2.0 which does not support vs 2022 (

if (ret.versionMajor === 15) {
ret.versionYear = 2017
return ret
}
if (ret.versionMajor === 16) {
ret.versionYear = 2019
return ret
}
).

Then I tried to update node-gyp to latest 8.4.0 currently (

if (ret.versionMajor === 15) {
ret.versionYear = 2017
return ret
}
if (ret.versionMajor === 16) {
ret.versionYear = 2019
return ret
}
if (ret.versionMajor === 17) {
ret.versionYear = 2022
return ret
}
) in npm directory which was C:\Users\Liu.D.H\AppData\Roaming\nvm\v16.13.0\node_modules\npm on my environment. And this error disappeared.

npm ERR! gyp verb find VS msvs_version was set from command line or npm config
npm ERR! gyp verb find VS - looking for Visual Studio version 2022
npm ERR! gyp verb find VS running in VS Command Prompt, installation path is:
npm ERR! gyp verb find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp verb find VS - will only use this version
npm ERR! gyp sill find VS Running C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [
npm ERR! gyp sill find VS   '-ExecutionPolicy',
npm ERR! gyp sill find VS   'Unrestricted',
npm ERR! gyp sill find VS   '-NoProfile',
npm ERR! gyp sill find VS   '-Command',
npm ERR! gyp sill find VS   "&{Add-Type -Path 'C:\\Users\\Liu.D.H\\AppData\\Roaming\\nvm\\v16.13.0\\node_modules\\npm\\node_modules\\node-gyp\\lib\\Find-VisualStudio.cs';[VisualStudioConfiguration.Main]::PrintJson()}"
npm ERR! gyp sill find VS ]
npm ERR! gyp sill find VS PS stderr = ""
npm ERR! gyp sill find VS processing installation: "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp sill find VS - version match = ["17.0.31903.59","17","0"]
npm ERR! gyp sill find VS - found VC.Tools.x86.x64
npm ERR! gyp sill find VS - found Win10SDK: 19041
npm ERR! gyp sill find VS vsInfo: [
npm ERR! gyp sill find VS   {
npm ERR! gyp sill find VS     version: '17.0.31903.59',
npm ERR! gyp sill find VS     versionMajor: 17,
npm ERR! gyp sill find VS     versionMinor: 0,
npm ERR! gyp sill find VS     versionYear: 2022,
npm ERR! gyp sill find VS     path: 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community',
npm ERR! gyp sill find VS     msBuild: 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe',
npm ERR! gyp sill find VS     toolset: 'v143',
npm ERR! gyp sill find VS     sdk: '10.0.19041.0'
npm ERR! gyp sill find VS   }
npm ERR! gyp sill find VS ]
npm ERR! gyp verb find VS checking VS2022 (17.0.31903.59) found at:
npm ERR! gyp verb find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp verb find VS - found "Visual Studio C++ core features"
npm ERR! gyp verb find VS - found VC++ toolset: v143
npm ERR! gyp verb find VS - found Windows SDK: 10.0.19041.0
npm ERR! gyp info find VS using VS2022 (17.0.31903.59) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
```

@cclauss
Copy link
Contributor

cclauss commented Nov 11, 2021

https:/nodejs/node-gyp/releases --> v8.4.0

@olawalejuwonm
Copy link

I also have issues with this

@wsdt
Copy link

wsdt commented Mar 5, 2022

me as well

@fredzhang7
Copy link

me as well

I fixed this by downloading the 2017 Visual Studio Community on https://www.techspot.com/downloads/6278-visual-studio.html

@nodejs nodejs locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ffi-napi Node Sass --> Dart Sass https:/sass/node-sass/issues/2952 Windows
Projects
None yet
Development

No branches or pull requests

8 participants