Electron Builder / SerialPort (Native)


#1

I’m developing an Electron application that uses node-serialport, which is a native module. I have it working fine on my Ubuntu machine. However, I need to distribute this application to Windows computers. I’m having some trouble figuring out the right incantations to develop on Ubuntu 16.04, and then use electron-builder / electron-rebuild to generate an executable installer for Windows that builds and packages the node-serialport lib for Windows. Hoping someone here can help steer me in the right direction.

I have already tried putting node-serialport in my ./app/package.json and my ./package.json. I can build an executable installer for Windows no problem, but it’s clear to me that it’s bundling the node-serialport library built for linux because I’m getting console log errors in Windows that read something like: %1 is not a valid Win32 application, but this only happens when I attempt to invoke node-serialport. Do I have to actually build the application on a Windows machine to make this work?


#2

Pretty much, yes. I’m no expert but to compile native modules for the OS you need them to work on you have to compile it on that OS. Plus, code-signing will only work on the correct OS too.


#3

Hi Victor,

I found same issue with my electron app for serialport and I built it in windows 10. Could you please let me know if you found any solution for it?

Regards,
Shahib