Meddah Abdallah
Meddah Abdallah

Reputation: 706

Node module not working with Electron App

I am trying to make an app that uses the node-bluetooth module found in npm. But I am getting the following error :

App threw an error during load
Error: The module '/home/pi/AlucentOs/node_modules/node- 
bluetooth/build/Release/BluetoothSerialPort.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.module.(anonymous function) [as dlopen] 
(ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (/home/pi/AlucentOs/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/home/pi/AlucentOs/node_modules/node- 
bluetooth/index.js:3:48)

I have tryed deleting node_modules file, and reinstalling everything, but it doesn't work. I am running the following line :

electron .

package.json:

{
  "name": "alucentos",
  "version": "1.0.0",
  "description": "AlucentX Operating System",
  "main": "index.js",
  "scripts": {
  "start": "electron .",
 },
 "author": "meddahAbdallah",
 "license": "ISC",
 "devDependencies": {
 "electron": "^4.1.2",
 "node-bluetooth": "^1.2.5"
 },
 "dependencies": {
 "node-bluetooth": "^1.2.5"
 }
}

Upvotes: 0

Views: 1298

Answers (1)

You need to have Node.js v10 in order to run node-bluetooth version 1.2.5

Solutions:

  • Install Node.js v10 in if you want to run node-bluetooth version 1.2.5 Node Homepage

    OR

  • Install other version of node-bluethooth which is compatible with Node.js v8, you can find all versions of node-bluetooth here, as well the dependicies and install instructions

Helpful link: Node module versions

Upvotes: 1

Related Questions