Skip to content

better-sqlite3 12.3.0 fails to build on Node.js latest (25) #1411

@daniel-hauser

Description

@daniel-hauser
  • Building better-sqlite3@12.3.0 on Node.js 25.0.0 fails because util/macros.cpp is not found during the native compilation step.
  • Although Node 25 is not yet listed as officially supported, the widespread use of node:latest (which switched to 25 on 2025-10-15) means many projects will encounter this failure

Reproduction Steps

  1. Copy the following Dockerfile into your workspace

    ARG NODE_VERSION=24
    FROM node:${NODE_VERSION}
    
    WORKDIR /app
    
    RUN cat <<'EOF' > package.json
    {
      "name": "better-sqlite3-node-repro",
      "version": "1.0.0",
      "private": true,
      "type": "module",
      "dependencies": {
        "better-sqlite3": "12.3.0"
      }
    }
    EOF
    
    RUN npm install --package-lock-only
    RUN npm ci
  2. Build with Node 24 (succeeds):

    docker build --no-cache --progress=plain -t repro-node24 --build-arg NODE_VERSION=24 .
  3. Build with Node 25 (fails):

    docker build --no-cache --progress=plain -t repro-node25 --build-arg NODE_VERSION=25 .

Expected Result

  • npm ci should complete successfully for both Node 24 and Node 25.

Actual Result (Node 25)

  • npm ci exits with node-gyp error fatal error: util/macros.cpp: No such file or directory.

Key Portion of the Failing Output

npm warn EBADENGINE Unsupported engine { package: 'better-sqlite3@12.3.0', required: { node: '20.x || 22.x || 23.x || 24.x' }, current: { node: 'v25.0.0', npm: '11.6.2' } }
...
../src/better_sqlite3.cpp:21:10: fatal error: util/macros.cpp: No such file or directory
   21 | #include "util/macros.cpp"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [better_sqlite3.target.mk:122: Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
npm ERR! gyp ERR! build error

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