Skip to content

Problem using better-sqlite3 with jest #229

@Gletschr

Description

@Gletschr

An error occured during running jest tests:

The module '/Users/user/node-js-app/node_modules/better-sqlite3/build/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 69. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).

  at Runtime.requireModule (node_modules/jest-runtime/build/index.js:372:31)
  at Object.<anonymous> (node_modules/better-sqlite3/lib/database.js:5:21)

jest version: 23.6.0
better-sqlite3 version: 5.4.0

My app running at NODE_MODULE_VERSION 69 (better-sqlite3 also being compiled using 69 version of node), but things looks like that jest runtime used different version of node (64).

Currently I am going around with this problem running npm rebuild (which recompiles better-sqlite3 to 64 version of node) before tests, but after that application becoming broken (app required better-sqlite3 compiled with 69 version of node).

Anyone has an idea how to fix this problem correctly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions