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.

Problem Compiling Node-Serialport For Windows Via Boilerplate

See original GitHub issue

Hi,

Not sure whether this is an issue with the boilerplate or with Node-Serialport. I’ve already opened this same issue there though just in case.

I’ve been working on a number of Electron apps using Electron-React-Boilerplate and all works 100% on Mac in dev and production build mode. I am now at a point where I would like to package a build for Windows to try out, but it appears that Node-Serialport is not being compiled for Windows.

The boilerplate uses two package.json files, one for general packages, one inside /app for native packages (which is where I have installed Node-Serialport v7).

The boilerplate uses Electron-Builder but I am having a bit of a headache trying to determine whether it is actually attempting to rebuild Node-Serialport for Windows.

I’ve built a development mode exe so I can see the console, and there seems to be signs that it is - as the error originates from app.asar\node_modules\@serialport\bindings\lib\win32.js:1:191

screen shot 2018-08-30 at 14 48 06
C:\Users\Rav\AppData\Local\Programs\electron-react-boilerplate\resources\app.asar\node_modules\bindings\bindings.js:88 Uncaught Error: \\?\C:\Users\Rav\AppData\Local\Temp\5674fa73-34ed-4f4e-a30a-b730940b259f.tmp.node is not a valid Win32 application\\?\C:\Users\Rav\AppData\Local\Temp\5674fa73-34ed-4f4e-a30a-b730940b259f.tmp.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:180:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (module.js:586:17)
    at require (internal/module.js:11:18)
    at bindings (C:\Users\Rav\AppData\Local\Programs\electron-react-boilerplate\resources\app.asar\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> (C:\Users\Rav\AppData\Local\Programs\electron-react-boilerplate\resources\app.asar\node_modules\@serialport\bindings\lib\win32.js:1:191)

I have read previous issues about building for Windows, but it seems that node-gyp is no longer used on newer versions of Node-Serialport, so I am not sure how to continue. I did also add "buildDependenciesFromSource": true into my package.json but there has been no difference.

Is there anything I can try? In the interim I am producing a test app with the exact configuration of my actual app. Will add a link shortly.

Summary of Problem

Unable to build for Windows on Electron.

Steps and Code to Reproduce the Issue

Here’s a quick example app I put together to demonstrate the issue

Package name(s) and version(s)

Electron-React-Boilerplate: 0.15.0 (https://github.com/chentsulin/electron-react-boilerplate.git) Node-Serialport: 7.0.2

Node version, Operating System and hardware

Node: 10.4.1 Operating System: MacOS High Sierra 10.13.5 Windows: Windows 10 Pro X64

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
caphuncommented, Sep 11, 2018

I have exact same problem as OP using node v8.11.1 and tested node-serialport versions 7.0.2, 7.0.1, and 6.2.2. Not sure if it’s a node-serialport issue as I’m also trying to build a windows app on mac.

0reactions
amilajackcommented, Sep 27, 2018

Correct. If you don’t want to use a vm. Building native dependencies for windows requires micrsoft proprietary SDK’s, which aren’t available on mac or linux

Read more comments on GitHub >

github_iconTop Results From Across the Web

node-serialport 6.x.x doesn't receive data or errors on ...
However, when I run it on my Windows 10 machine, I do not get any response at all. Neither the port.on('data') or port.on('error')...
Read more >
Installing SerialPort
If you have a special case, Node SerialPort will work, but it will compile the binary during the install. Compiling with nodejs is...
Read more >
node-hid | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
cncjs | cncjs
A web-based interface for CNC milling controller running Grbl, Smoothieware, or TinyG. It runs on an Raspberry Pi or a laptop computer that...
Read more >
Native Node Modules
Error : The module '/path/to/native/module.node' was compiled against a different Node.js version using. NODE_MODULE_VERSION $XYZ. This version of Node.js ...
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