Skip to content

Electron app crashing with latest better-sqlite3 #1062

@jayakrishnankp

Description

@jayakrishnankp

I was using better-sqlite3 with the version as ^8.3.0 in package.json in my electron app for some time.
On a recent npm install, better-sqlite3 version 8.6.0 was installed, which causes my app to crash with an error message:

node_modules/better-sqlite3/build/Release/better_sqlite3.node' was compiled against a 
different Node.js version using NODE_MODULE_VERSION 108. This version of Node.js 
requires NODE_MODULE_VERSION 116.

NOTE: When I switch my version back to 8.4.0 or less, everything works fine

Steps to Reproduce

  1. Create a sample Electron app (you can clone the quick start project here) or use any existing one
  2. Install better-sqlite3 version 8.6.0 and electron-rebuild
  3. Import better-sqlite3 in main.js and initialize the db:
    const sqlite = require("better-sqlite3");
    const db = sqlite("newdb.sqlite.db")
    console.log("Created db", db); 
    
  4. Run the electron app using npm run start
  5. See error

Versions

  • Node: 18.12.1
  • Electron: 24.1.2
  • electron-rebuild: 3.3.0

Expected behaviour
No error and the console log is expected

Addition Context

  • After using electron-rebuild to rebuild the package (which is the usual case), the process exits without any better-sqlite3 error message:
    The crash happens at the bit of code which creates the new db file:
const db = require('better-sqlite3')('myDb.db');
  • And the error message is:
node_modules/electron/dist/Electron.app/Contents/MacOS/Electron exited with signal SIGKILL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions