Nitro's rollupConfig.external leaves require('better-sqlite3') in
the bundle, but Node resolves from .output/server/ not /app/.
NODE_PATH=/app/node_modules fixes this. Also increase healthcheck
start-period to 30s with 5 retries.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pnpm's symlink store prevents better-sqlite3 native bindings from
being compiled/found. npm places files directly and compiles native
modules reliably.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pnpm install doesn't compile native bindings in Alpine. Explicit
rebuild ensures the .node file is generated.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
apk del python3 cascades to remove sqlite-libs. Only remove make/g++.
Add debug step to verify better_sqlite3.node was built.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nitro.externals.external doesn't prevent Rollup from inlining the
require. rollupConfig.external tells Rollup directly to leave the
import as-is, so Node resolves it from node_modules at runtime.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Multi-stage builds break better-sqlite3 because the native .node
binding and its bindings/file-uri-to-path deps need to be in
node_modules at runtime. Single stage keeps everything in place.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pnpm uses .pnpm symlink store, so the binding isn't at the
standard node_modules path. Use find to locate the .node file
and copy it to where Nitro expects it.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The .node binary wasn't being copied to .output, causing 'Could not locate
the bindings file' error at runtime.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Nuxt 3 app with:
- SQLite (better-sqlite3) for persistence
- Anonymous idea submission and voting
- Admin auth with session cookies
- AI analysis via Gemini API
- Nuxt UI components + Tailwind
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>