Reputation: 11
sorry for the long post, I've been googling a lot for a solution but couldn't find one. I'm trying to write a simple Electron app to display an html page (no problem with that thankfully) and to control a printer, thing that must be done through the usb module installed via npm. That module and the code that relies on it always worked perfectly in pure node.js software so that's not where to look for the problem, but I'm having a hard time integrating it in my Electron app. I have to use Ubuntu 14.04, and the system already has node 12.20.0 + npm 6.14.8, both installed via nvm without any warning (I can install different versions if there's any known conflict). Due to a series of difficulties using Electron installed via npm, I resorted to using the prebuilt binaries package of it (version 11.1.1, but again that's something I can change if needed) that can be downloaded from https://github.com/electron/electron/releases/tag/v11.1.1
Here's what I do:
This is what I get:
./electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by ./electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/totem/totem/resources/app/node_modules/usb/build/Release/usb_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/home/totem/totem/resources/app/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/totem/totem/resources/app/node_modules/usb/usb.js:1:57)
Segmentation fault
An unhandled error occurred inside electron-rebuild
Unable to find electron's version number, either install it or specify an explicit version
Error: Unable to find electron's version number, either install it or specify an explicit version
at /home/totem/totem/resources/app/node_modules/electron-rebuild/lib/src/cli.js:82:19
./electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by ./electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/totem/totem/resources/app/node_modules/usb/build/Release/usb_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/home/totem/totem/resources/app/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/totem/totem/resources/app/node_modules/usb/usb.js:1:57)
What's happening? It's like electron-rebuild did nothing at all. I can change everything but the operating system and (unless no other solution is available) the fact that i use Electron prebuilt packages instead on $npm install electron. Any idea what's wrong? Thank you all for your attention.
Upvotes: 1
Views: 735
Reputation: 333
You must rebuild any
npm rebuild
# or
npm install electron-rebuild --save-dev
./node_modules/.bin/electron-rebuild
Upvotes: 0