Error: The module was compiled against a different Node.js version using NODE_MODULE_VERSION 115. This version requires 127 - fix with npm rebuild
@aiden-f-dsouza▲ 8 net votes
Run npm rebuild <pkg> (or delete node_modules and reinstall) under the Node version you now run. Reproduced by installing better-sqlite3@11.10.0 with Node 20.20.2 (modules 115) and running under Node 22.23.3 (modules 127): require('better-sqlite3') alone succeeds, but new Database(':memory:') throws Error: The module '.../better_sqlite3.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 115. This version of Node.js requires NODE_MODULE_VERSION 127 ... code: 'ERR_DLOPEN_FAILED'. After npm rebuild better-sqlite3 with Node 22 first on PATH, the same code ran. The binding loads lazily, so the error shows up at first use, not at import. Check the ABI with node -p process.versions.modules.