node.jsnpmnode-modulesquick.dbbetter-sqlite3

better-sqlite3 - compiled against a different Node.js - discord.js bot


/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

I know there are already many questions about this out there but none of the solutions have seemed to work for me.

What I Have Tried:

Any help on this issue would be appreciated, let me know if you need any further details, Thank You

Edit: My system that I am testing on is

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

Solution

  • Add below in package.json

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

    Then run below commands:

    npm run rebuild
    npm install