MadLittleMods / node-usb-detection

List USB devices in system and detect changes on them.
MIT License
371 stars 114 forks source link

GitHub Actions CI failing on Windows runners - `Error: Could not find any Visual Studio installation to use` #164

Closed MadLittleMods closed 2 years ago

MadLittleMods commented 2 years ago

The GitHub Actions CI was last known working on 2022-01-20 with the windows-2019 runners, https://github.com/MadLittleMods/node-usb-detection/runs/4889718474

But now fails on the windows-2022 runners, https://github.com/MadLittleMods/node-usb-detection/runs/5321088170

npm ci --build-from-source

> usb-detection@[4](https://github.com/MadLittleMods/node-usb-detection/runs/5321088170?check_suite_focus=true#step:5:4).13.0 install D:\a\node-usb-detection\node-usb-detection
> prebuild-install || node-gyp rebuild

D:\a\node-usb-detection\node-usb-detection>if not defined npm_config_node_gyp (node "C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
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\Enterprise"
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 201[5](https://github.com/MadLittleMods/node-usb-detection/runs/5321088170?check_suite_focus=true#step:5:5)
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://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS 
gyp ERR! configure error 
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\hostedtoolcache\windows\node\12.22.10\x[6](https://github.com/MadLittleMods/node-usb-detection/runs/5321088170?check_suite_focus=true#step:5:6)4\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:4[7](https://github.com/MadLittleMods/node-usb-detection/runs/5321088170?check_suite_focus=true#step:5:7))
gyp ERR! stack     at C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack     at C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\hostedtoolcache\windows\node\12.22.10\x64\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:315:5)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
gyp ERR! System Windows_NT 10.0.2034[8](https://github.com/MadLittleMods/node-usb-detection/runs/5321088170?check_suite_focus=true#step:5:8)
gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\12.22.10\\x64\\node.exe" "C:\\hostedtoolcache\\windows\\node\\12.22.10\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\node-usb-detection\node-usb-detection
gyp ERR! node -v v12.22.10
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! usb-detection@4.13.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the usb-detection@4.13.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\npm\cache\_logs\2022-02-24T15_33_10_10[9](https://github.com/MadLittleMods/node-usb-detection/runs/5321088170?check_suite_focus=true#step:5:9)Z-debug.log
Error: Process completed with exit code 1.

Dev notes

Relevant blogs:

MadLittleMods commented 2 years ago

I've done some work to try to address this and gotten pretty far, https://github.com/MadLittleMods/node-usb-detection/pull/165

It seems like the last blocker is waiting for https://github.com/prebuild/prebuild/issues/286 to be solved to have node-gyp updated within prebuild itself so it can actually see Visual Studio 2022. This is tracked in that PR under this thread https://github.com/MadLittleMods/node-usb-detection/pull/165#discussion_r818234723