Repository navigation
Description
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
- Install the project dependencies:
pnpm install - Run
pnpm run dev→ fails - Run
pnpm run bootstrap→ fails with "Failed to create database" error - 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
fix(core): give actionable error when better-sqlite3 native binary is…
fix(core): give actionable error when better-sqlite3 native binary is…
fix(core): replace better-sqlite3 with node:sqlite in the sqlite adap…