question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to build binary modules on windows-latest

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

5reactions
reconbotcommented, Sep 29, 2019

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

    - name: patch node gyp on windows to support Visual Studio 2019
      shell: powershell
      run: |
        npm install --global node-gyp@latest
        npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}

I use a matrix for multiple OS’s so I also have this line to only run it on windows.

      if: matrix.os == 'windows-latest'
1reaction
vladimirycommented, May 18, 2021

@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)
  InstanceId          : 2a98bf0b
  DisplayName         : Visual Studio Build Tools 2017
  InstallationVersion : 15.9.28307.1500
  InstallationPath    : C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
  InstallDate         : 5/6/2021 8:07:08 PM
  
  Id       : Microsoft.VisualStudio.Component.Windows81SDK
  Version  : 15.6.27406.0
  Chip     : 
  Language : 
  Branch   : 
  
  Ticks             : 2050333112
  Days              : 0
  Hours             : 0
  Milliseconds      : 33
  Minutes           : 3
  Seconds           : 25
  TotalDays         : 0.00237307073148148
  TotalHours        : 0.0569536975555556
  TotalMilliseconds : 205033.3112
  TotalMinutes      : 3.41722185333333
  TotalSeconds      : 205.0333112
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found