I\'m trying to make an Electron application (https://electron.atom.io/) that reads data from my serial port. I\'m new to web technologies in general, I know some javascript,
electron-rebuild
on postinstall
.Depending on what you're doing, you can use electron-rebuild to rebuild serialport
to the version of electron
you have installed.
To do so:
npm install --save-dev electron-rebuild
$(npm bin)/electron-rebuild # Mac and Linux.
.\node_modules\.bin\electron-rebuild.cmd # Windows.
Because I kept forgetting to do this after doing an npm install (and to help others that downloaded the project), I added the following two scripts to package.json
:
"scripts": {
"start": "electron .",
"postinstall": "electron-rebuild",
"electron-rebuild": "electron-rebuild"
},
The postinstall
will automatically run after doing a npm install
so after the typical install finishes you'll see a console log message with electron-rebuild
and it will automatically rebuild serialport
, and any other native library you have, to the electron
version. This means that you shouldn't even have to think about running electron-rebuild
going forward.