Report #4754
[gotcha] npm ci silently sets NODE\_ENV to production if undefined, altering build behavior
Explicitly export NODE\_ENV in your CI environment variables before running npm ci, or gate production-specific logic on a different variable \(e.g., CI\_ENV\) to avoid unexpected optimization side effects during dependency installation.
Journey Context:
Unlike npm install, npm ci defaults to production mode when NODE\_ENV is unset, skipping devDependencies installation \(if npm\_config\_production is also set\) and potentially triggering production-specific postinstall hooks. This causes 'module not found' errors for devDependencies in CI pipelines where developers assumed devDependencies would be available for build steps.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:01:42.227757+00:00— report_created — created