Unable to build binary modules on windows-latest
See original GitHub issueI think this is just a path issue. As part of node serialport’s test process I need to ensure we can build the binary. I run node-gyp rebuild
on the binary package and I get the following error.
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT
full stack below
D:\a\node-serialport\node-serialport\packages\bindings>if not defined npm_config_node_gyp (node "C:\hostedtoolcache\windows\node\8.10.0\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\8.10.0\x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
lerna ERR! npm install stderr:
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at _errnoException (util.js:1022:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:372:16)
gyp ERR! stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:180:9)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\8.10.0\\x64\\node.exe" "C:\\hostedtoolcache\\windows\\node\\8.10.0\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\node-serialport\node-serialport\packages\bindings
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! This is a bug in `node-gyp`.
https://github.com/serialport/node-serialport/runs/240073493
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
Next failed to load SWC binary - Stack Overflow
The error is occurring because Next.js is using Rust-based compiler SWC to compile JavaScript/TypeScript now and for this SWC requires a binary ......
Read more >failed-loading-swc - Next.js
Next.js now uses Rust-based compiler SWC to compile JavaScript/TypeScript. ... In some cases this binary may fail to load either from failing to...
Read more >I can build this app on my development machine, but it fails to ...
We're working on a WPF app using .NET Framework 4.7.2. We utilize a NuGet package called Microsoft.SqlServer.Types, version 12.0.5000.
Read more >Set up automated builds for your UWP app - Microsoft Learn
Configure the Build solution build task. This task compiles any solution that's in the working folder to binaries and produces the output app ......
Read more >OpenSSL 3.0.7 and 1.1.1s Binaries for Microsoft Windows
We thought it would be useful to make our OpenSSL Binary Distribution available for you to download and use in a standalone fashion...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Turns out this is an issue with node-gyp and visual studio 2019.
After coming through some steps here https://github.com/nodejs/node-gyp/issues/1663 I was able to figure out a way through
I use a matrix for multiple OS’s so I also have this line to only run it on windows.
@kiruh I spent a lot of time trying to compile a native modules on windows-latest system but didn’t succeed. What I ended up doing is installing vs 2017 which helped. Here is the installing script https://github.com/vladimiry/ElectronMail/blob/4104ef5bfe4dc613c68f3aef67264d67394475cb/scripts/ci/github/install-vs-build-tools.ps1 + its call https://github.com/vladimiry/ElectronMail/blob/4104ef5bfe4dc613c68f3aef67264d67394475cb/scripts/ci/github/package-app.ps1#L2-L3.
Updating node-gyp is also required in my case https://github.com/vladimiry/ElectronMail/blob/1d5955b80d705ce2a789fafa6c40198f32637986/scripts/ci/github/install-node-gyp.ps1#L1 but that’s a little different story. It helps with compiling some native modules I use, but only some, not all of them.
Here is what gets installed by the above-referenced "install-vs-build-tools.ps1" script (installing takes ~ 3.5 minutes)