Dortysox
Dortysox

Reputation: 1

I have a better_sqlite3.node error when i require quick.db

i dont have errors when i install but when i require quick.db in my main.js (its a discord.js bot in v12)

const db = require('quick.db')

i have an better_sqlite3.node error in my terminal

-C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\bindings\bindings.js:121
        throw e;
        ^

Error: The module '\\?\C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\better-sqlite3\build\Release\better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at bindings (C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\better-sqlite3\lib\database.js:9:24)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'ERR_DLOPEN_FAILED'
}
PS C:\Users\Fatsah\Desktop\Wizzy Bot> 

i tried to reinstall and update node.js into the last test

Node version : v16.7.0

Discord.js : v12.5.3

Npm Version : 7.20.3

I have this error not long ago, when I was using node v14 and I have the same with canvas / canvacord but is canvas.node

Upvotes: 0

Views: 1522

Answers (2)

deadcoder0904
deadcoder0904

Reputation: 8683

I solved it by installing better-sqlite3 in Dockerfile instead of package.json & using pnpm's supportedArchitectures feature.

Upvotes: 0

Palm
Palm

Reputation: 709

Reinstall all your dependencies, you probably upgraded Node after you installed better-sqlite3 and you need to rebuild the library again.

Upvotes: 1

Related Questions