我正在尝试制作一个使用npm中的node-bluetooth模块的应用程序。但是我收到以下错误:
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)
我尝试删除node_modules文件,然后重新安装所有内容,但是它不起作用。 我正在运行以下行:
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"
}
}
答案 0 :(得分:0)
您必须具有Node.js v10才能运行节点蓝牙1.2.5版
解决方案:
如果要运行节点蓝牙版本1.2.5 Node Homepage
,请安装Node.js v10。OR
安装与Node.js v8兼容的其他版本的node-bluethooth,您可以找到所有版本的node-bluetooth here以及依赖项和安装说明
有用的链接: Node module versions