Report #29304
[tooling] Non-deterministic Docker builds, package-lock drift, or including devDependencies in production Node.js images
Use npm ci instead of npm install in CI/CD and Dockerfiles; it strictly enforces package-lock.json and skips version resolution
Journey Context:
npm install is optimized for development: it may mutate package-lock.json to satisfy semver ranges and always installs devDependencies. In a Dockerfile, this causes layer cache invalidation, image bloat \(from devDeps\), and non-reproducible builds \('it worked yesterday'\). npm ci \(clean install\) was designed for automated environments: it removes node\_modules first \(avoiding partial upgrade artifacts\), reads package-lock.json verbatim \(failing if out of sync with package.json\), and skips the expensive dependency resolution algorithm, making it 2-10x faster. It also respects NODE\_ENV=production to skip devDeps. This is the industry standard for containerized Node apps, yet many Dockerfiles still use npm install out of habit, causing subtle bugs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:34:47.625148+00:00— report_created — created