Report
A student hit this running npm run db:migrate on a fresh clone, before any code changes:
npm run db:migrate
db:migrate
drizzle-kit migrate
No config path provided, using default 'drizzle.config.ts'
Reading config file '/workspace/drizzle.config.ts'
Error: Could not locate the bindings file. Tried:
→ /workspace/node_modules/better-sqlite3/build/better_sqlite3.node
...
Reported environment: npm v10.9.8, node v22.23.2, fresh git pull same day.
Note the path prefix /workspace/... — not a normal host clone path, so this may be happening inside Docker/a devcontainer/WSL rather than directly on the reporter's machine (unconfirmed).
Investigation so far
- Reproduced a clean install in a throwaway copy of this repo (
rm -rf node_modules && npm install && npm run db:migrate) on Linux x64 — worked fine. better-sqlite3's install step (prebuild-install || node-gyp rebuild --release) successfully downloaded a prebuilt binary from GitHub releases; no compile fallback was needed.
- So this doesn't look like a broken lockfile or a repo-wide regression — it reproduces only in the reporter's environment.
better-sqlite3's install script downloads a prebuilt native binary over the network, falling back to a local node-gyp compile (needs python3 + a C/C++ toolchain) if that fails. If both the network fetch and the compile fallback fail/are skipped, npm install can exit 0 while leaving no .node binding — surfacing later as this exact error at db:migrate time rather than at install time.
Likely causes (unconfirmed — need more info from reporter)
- Running inside a container/devcontainer/WSL where
node_modules was built on a different OS/arch than the one actually executing db:migrate (classic bind-mount/cross-arch mismatch) — the /workspace path is the main clue pointing here.
- No outbound network access to GitHub releases during
npm install (corporate proxy/VPN/offline sandbox), combined with missing local build tools (python3/make/g++, or Windows build tools) for the compile fallback.
ignore-scripts set (globally or via npm config) so better-sqlite3's install script never runs at all.
- Antivirus / cloud-sync (e.g. OneDrive) stripping the compiled
.node binary after install.
Next steps
Asked the reporter to confirm:
- Whether they're running inside Docker/a devcontainer/WSL/cloud IDE, or
/workspace is just their host folder name.
- The OS/arch actually executing the commands (host vs. container, if applicable).
- Output of:
npm config get ignore-scripts
rm -rf node_modules
npm install --loglevel=verbose 2>&1 | grep -iE "better-sqlite3|prebuild|gyp"
npm rebuild better-sqlite3 --verbose
Once we know the actual cause, this may turn into a README troubleshooting note for future students, since this is a plausible recurring pain point (native module install on varied student machines).
Report
A student hit this running
npm run db:migrateon a fresh clone, before any code changes:Reported environment: npm v10.9.8, node v22.23.2, fresh
git pullsame day.Note the path prefix
/workspace/...— not a normal host clone path, so this may be happening inside Docker/a devcontainer/WSL rather than directly on the reporter's machine (unconfirmed).Investigation so far
rm -rf node_modules && npm install && npm run db:migrate) on Linux x64 — worked fine.better-sqlite3's install step (prebuild-install || node-gyp rebuild --release) successfully downloaded a prebuilt binary from GitHub releases; no compile fallback was needed.better-sqlite3's install script downloads a prebuilt native binary over the network, falling back to a localnode-gypcompile (needs python3 + a C/C++ toolchain) if that fails. If both the network fetch and the compile fallback fail/are skipped,npm installcan exit 0 while leaving no.nodebinding — surfacing later as this exact error atdb:migratetime rather than at install time.Likely causes (unconfirmed — need more info from reporter)
node_moduleswas built on a different OS/arch than the one actually executingdb:migrate(classic bind-mount/cross-arch mismatch) — the/workspacepath is the main clue pointing here.npm install(corporate proxy/VPN/offline sandbox), combined with missing local build tools (python3/make/g++, or Windows build tools) for the compile fallback.ignore-scriptsset (globally or via npm config) sobetter-sqlite3's install script never runs at all..nodebinary after install.Next steps
Asked the reporter to confirm:
/workspaceis just their host folder name.Once we know the actual cause, this may turn into a README troubleshooting note for future students, since this is a plausible recurring pain point (native module install on varied student machines).