Problem Compiling Node-Serialport For Windows Via Boilerplate
See original GitHub issueHi,
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
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:
- Created 5 years ago
- Comments:22 (9 by maintainers)

Top Related StackOverflow Question
I have exact same problem as OP using node
v8.11.1and testednode-serialportversions7.0.2,7.0.1, and6.2.2. Not sure if it’s anode-serialportissue as I’m also trying to build a windows app on mac.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