node-serialport: Error "is not Win32 application" when use electron-builder
SerialPort Version
10.5.0
Node Version
v16.14.2
Electron Version
23.2.0
Platform
Microsoft Windows NT 10.0.19045.0
Architecture
x64
Hardware or chipset of serialport
No response
What steps will reproduce the bug?
Dev machine: Linux zivlak 6.1.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 21 Dec 2022 22:27:55 +0000 x86_64 GNU/Linux Test machine: Microsoft Windows NT 10.0.19045.
Electron builder version: 23.6.0 Electron builder target: portable x64
- Create electron project
- Import SerialPort
- Build project using electron-builder on Linux machine
- Copy .exe file to windows machine and run it
What happens?
Uncaught Error: \\?\C:\Users\ZI\AppData\Local\Temp\3c0cfb43-c0d6-41df-8ecf-ce6623539fad.tmp.node is not a valid Win32 application.
\\?\C:\Users\ZI\AppData\Local\Temp\3c0cfb43-c0d6-41df-8ecf-ce6623539fad.tmp.node
at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
at Module._extensions..node (node:internal/modules/cjs/loader:1259:18)
at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2049)
at Module.load (node:internal/modules/cjs/loader:1044:32)
at Module._load (node:internal/modules/cjs/loader:885:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at o._load (node:electron/js2c/renderer_init:2:3109)
at Module.require (node:internal/modules/cjs/loader:1068:19)
at require (node:internal/modules/cjs/helpers:103:18)
at load (C:\Users\ZI\AppData\Local\Temp\2O4lZlaiKxPE0OCBtsho17I24ti\resources\app.asar\node_modules\node-gyp-build\node-gyp-build.js:22:10)
What should have happened?
Program should list all available ports on machine, but it’s crash on importing SerialPort module.
Additional information
No response
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 18 (5 by maintainers)
@GazHank riveting investigation!
Thanks to the electron-builder team this should now be fixed in their new version 24.5.1
We can suppose you got a better/working one, illuminate us!
Solution is to build in a windows machine. Had the same issue developing in a Mac, the build in a Win VM ran with no issue.