I'm having trouble with sqlite3 in my js project. I'm new to node, npm and coding in general.
The full error message:
Module did not self-register: './node_modules/sqlite3/lib/binding/node-v72-darwin-x64/node_sqlite3.node'.
at Object.Module._extensions..node internal/modules/cjs/loader.js:1207
at Object.<anonymous> ./node_modules/sqlite3/lib/sqlite3.js:4
at Object.Module._extensions..js internal/modules/cjs/loader.js:1177
at Object.Module._extensions..js internal/modules/cjs/loader.js:1177
at Api/artists.js:4:0
Running:
node 12.16.2
npm 6.14.4
sqlite 4.1.1
mac os 10.15.2
I have tried some different versions of node and sqlite3, npm rebuild and rm -r node_modules then npm install as suggested here
Not sure what's causing this error. My guess is it has do to with versions of different npm packages not being compatible.
I've searched google and here, looked up npm docs etc. but haven't found exactly what I'm looking for. NPM docs hints that it might have to do with node-pre-gyb here which, after reading, I'm not comfortable messing around with.
const sqlite3 = require('sqlite3'); //error caught here//
const db = new sqlite3.Database(
process.env.TEST_DATABASE || './database.sqlite'
);```