我试图在我的电子应用程序中使用SQLite3,但我不断收到错误消息-
Uncaught Error: The module '\\?\\Desktop\Test\NHS-BDonor\node_modules\sqlite3\lib\binding\electron-v4.0-win32-x64\node_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 69. 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:160:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:722)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
at Module.load (internal/modules/cjs/loader.js:602)
at tryModuleLoad (internal/modules/cjs/loader.js:541)
at Function.Module._load (internal/modules/cjs/loader.js:533)
at Module.require (internal/modules/cjs/loader.js:640)
at require (internal/modules/cjs/helpers.js:20)
at Object.<anonymous> (\Desktop\Test\NHS-BDonor\node_modules\sqlite3\lib\sqlite3.js:4)
at Object.<anonymous> (\Desktop\Test\NHS-BDonor\node_modules\sqlite3\lib\sqlite3.js:190)
Package.json文件-
{
"name": "App",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"postinstall": "electron-builder install-app-deps",
"start": "electron ."
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "4.0.5",
"electron-builder": "^20.38.5"
},
"dependencies": {
"electron-rebuild": "^1.8.4",
"sqlite3": "^4.0.6",
"update-electron-app": "^1.3.0"
}
}
我已经尝试过许多关于stackoverflow和youtube的解决方案,但是似乎都没有用。在此问题上的任何投入/帮助将不胜感激。
答案 0 :(得分:1)
这似乎与电子助洗剂有关,请参见this issue on github。
作为一种解决方法,我已将电子版本固定为4.0.3(最新的仍在工作的版本),但是您也可以在上述发行单中找到another workaround。