I hit my head two times on this, getting serialdata via an Electron app, time to put the taken steps on paper.
I found this demo project and used it aswell: https://github.com/johnny-five-io/electron-serialport
I implemented some changes to push the data to a table.
The project code can be found on my github pagehttps://github.com/timdows/webpages/tree/master/ElectronSerial
Implementing serialport in an existing project
The installation is as easy as running the install command
[code]npm install –save-dev serialport[/code]
When trying to run electron I got:
According to the manual on github, it is needed to use electron-rebuild in order to solve this.
[code]npm install –save-dev electron-rebuild[/code]
Change package.json under the scripts section
run npm install, it will rebuild the serialport for us (takes a while on the Pi3)
A couple of weeks later I got this error ‘compiled against a different Node.js version’
Uncaught Error: The module 'xxx/serialport/build/Release/serialport.node' was compiled against a different Node.js version using
npm cache clear
rm -rf node_modules