Skip to content

Failed to create database when running pnpm run bootstrap/seed due to NODE_MODULE_VERSION mismatch (better-sqlite3) #562

Closed

Description

@ardhichoiruddin

Description

When running pnpm run bootstrap or pnpm run seed, the CLI fails with "Failed to create database" error. The root cause is a NODE_MODULE_VERSION mismatch: better-sqlite3 was compiled against Node.js v20 (NODE_MODULE_VERSION 115), but the current Node.js version is v22.22.2 which requires NODE_MODULE_VERSION 127.

Note: The project appears to be configured to use PostgreSQL as the database, so it is unexpected that better-sqlite3 (a SQLite native module) is being loaded at all. This may indicate a bundling or dependency issue where the SQLite adapter is being imported even when PostgreSQL is selected.

Expected behavior: pnpm run bootstrap and pnpm run seed should complete successfully without any native module version mismatch errors.

astro.config.mjs (relevant excerpt):

integrations: [
        react(),
        emdash({
            database: postgres({
                connectionString: process.env.DATABASE_URL || "postgres://localhost:5432/emdash_dev",
            }),
            storage: local({
                directory: "./uploads",
                baseUrl: "/_emdash/api/media/file",
            }),
            plugins: [auditLogPlugin()],
        }),
    ],

Steps to reproduce

  1. Install the project dependencies: pnpm install
  2. Run pnpm run dev → fails
  3. Run pnpm run bootstrap → fails with "Failed to create database" error
  4. Run pnpm run seed → also fails with the same "Failed to create database" error

Environment

  • emdash version: 0.5.0
  • Node.js version: v22.22.2
  • Runtime: Node
  • Database: PostgreSQL
  • OS: macOS
  • Package manager: pnpm

Logs / error output

**pnpm run bootstrap:**

ERROR  Failed to create database

    at createDatabase (node_modules/.pnpm/[email protected]_.../node_modules/emdash/dist/connection-B4zVnQIa.mjs:34:9)
    at Object.run (node_modules/.pnpm/[email protected]_.../node_modules/emdash/dist/cli/index.mjs:1522:14)
    at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:316:16)
    at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:307:11)
    at async runMain (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:445:7)

  [cause]: The module '/Users/project/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/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. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).


**pnpm run seed:**

ERROR  Failed to create database

    at createDatabase (node_modules/.pnpm/[email protected]_.../node_modules/emdash/dist/connection-B4zVnQIa.mjs:34:9)
    at Object.run (node_modules/.pnpm/[email protected]_.../node_modules/emdash/dist/cli/index.mjs:3698:14)
    at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:316:16)
    at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:307:11)
    at async runMain (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:445:7)

  [cause]: The module '/Users/project/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/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. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

Activity

  1. added
    bug
    on Apr 14, 2026
  2. added a commit that references this issue on Apr 15, 2026
    04e6cca
  3. added a commit that references this issue on Apr 27, 2026
    0e2d290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions