better-sqlite3 -针对不同的Node.js编译- discord.js bot

pn9klfpd  于 2023-03-29  发布在  Node.js
关注(0)|答案(1)|浏览(289)
/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: The module '/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. This version of Node.js requires
NODE_MODULE_VERSION 108. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Module._extensions..node (node:internal/modules/cjs/loader:1203:18)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at Module.require (node:internal/modules/cjs/loader:1021:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at bindings (/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/bindings/bindings.js:112:48)
    at new Database (/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/better-sqlite3/lib/database.js:48:64)
    at Database (/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/better-sqlite3/lib/database.js:11:10)
    at new SqliteDriver (/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/quick.db/out/drivers/SqliteDriver.js:8:25)
    at new QuickDB (/Users/dhyan/Downloads/Dhyan99-bot-v14 (4)/node_modules/quick.db/out/index.js:17:28) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v18.8.0

我知道已经有很多关于这方面的问题了,但没有一个解决方案似乎对我有效。

我尝试过的:

  • npm uninstall better-sqlite3
  • npm install better-sqlite3
  • Error coming every time I try to run my code
  • 删除node_modulespackage-lock.jsonpackage.json
  • 不同节点版本
  • 16.17.0 -错误日志中显示的NODE_MODULE_VERSION 93
  • 18.8.0 -即NODE_MODULE_VERSION 108,这是“必需”的版本
  • npm install --build-from-source

在这个问题上的任何帮助将不胜感激,让我知道,如果你需要任何进一步的细节,谢谢

  • 编辑:* 我正在测试的系统是
Software:

    System Software Overview:

      System Version: macOS 12.3.1 (21E258)
      Kernel Version: Darwin 21.4.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: Dhyan’s MacBook Air
      User Name: Dhyan Tanna (dhyan)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 20 days 1:27

Hardware:

    Hardware Overview:

      Model Name: MacBook Air
      Model Identifier: MacBookAir10,1
      Chip: Apple M1
      Total Number of Cores: 8 (4 performance and 4 efficiency)
      Memory: 8 GB
      System Firmware Version: 7459.101.3
      OS Loader Version: 7459.101.3
vom3gejh

vom3gejh1#

在package.json中添加以下内容

"scripts": {
    "rebuild": "electron-rebuild -f -w better-sqlite3",
    "postinstall": "electron-builder install-app-deps"
}

然后运行下面的命令:

npm run rebuild
npm install

相关问题