Overview: I wrote an electron app (modbus power meter) in Windows that uses npm packages modbus-serial & onoff. In Windows I would just use the serial modbus, but on a Raspberry Pi 4, I'd also use it's gpio pins to control a fixture. Everything works find in Windows. When I copy the package to the Pi, install node and install my package.json modules, I am unable to start the app (electron .).
package.json: (partial)
"scripts": {
"start": "electron .",
},
"dependencies": {
"modbus-serial": "^8.0.11",
"onoff": "^6.0.3",
"winston": "^3.9.0"
},
"devDependencies": {
"electron": "^25.1.0",
},
Output:
rpi@raspberrypi:~/Downloads $ npm start
> [email protected] start
> electron .
App threw an error during load
Error: No native build was found for platform=linux arch=arm runtime=electron abi=116 uv=1 armv=default libc=glibc node=18.15.0 electron=25.1.0
loaded from: /home/rpi/Downloads/node_modules/@serialport/bindings-cpp
at load.resolve.load.path (/home/rpi/Downloads/node_modules/node-gyp-build/node-gyp-build.js:60:9)
at load (/home/rpi/Downloads/node_modules/node-gyp-build/node-gyp-build.js:22:30)
at Object.<anonymous> (/home/rpi/Downloads/node_modules/@serialport/bindings-cpp/dist/load-bindings.js:11:46)
at Module._compile (node:internal/modules/cjs/loader:1269:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
at Module.load (node:internal/modules/cjs/loader:1124:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1148:19)
at require (node:internal/modules/cjs/helpers:110:18)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: No native build was found for platform=linux arch=arm runtime=electron abi=116 uv=1 armv=default libc=glibc node=18.15.0 electron=25.1.0
loaded from: /home/rpi/Downloads/node_modules/@serialport/bindings-cpp
at load.resolve.load.path (/home/rpi/Downloads/node_modules/node-gyp-build/node-gyp-build.js:60:9)
at load (/home/rpi/Downloads/node_modules/node-gyp-build/node-gyp-build.js:22:30)
at Object.<anonymous> (/home/rpi/Downloads/node_modules/@serialport/bindings-cpp/dist/load-bindings.js:11:46)
at Module._compile (node:internal/modules/cjs/loader:1269:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
at Module.load (node:internal/modules/cjs/loader:1124:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1148:19)
at require (node:internal/modules/cjs/helpers:110:18)
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
^C/home/rpi/Downloads/node_modules/electron/dist/electron exited with signal SIGINT
Things I tried: I think the problem might be related to *onoff *and/or modbus-serial (which uses serialport) since I've gotten various errors related to both. Besides the output listed, I've also gotten node-gyp can't rebuild epoll or serialport errors. On linux, I've loaded python and tried building a package using electron-builder, but even running it leads to errors either building it or trying to run it. I've also tried loading the latest version of gyp-rebuild as dev dependency.
Any help would be greatly appreciated! If I have to leave electron behind, I'm going to need to spend lots of extra time because of all the IPC.
Thanks!