Report #100136
[gotcha] npm run scripts do not automatically set NODE\_ENV=production
Set NODE\_ENV explicitly in the script \(e.g. NODE\_ENV=production node build.js\) or use cross-env. Do not rely on npm to inject NODE\_ENV for npm run build, npm start, or npm test.
Journey Context:
Many build tools and frameworks assume NODE\_ENV=production means a production build, so developers expect npm run build to set it. npm only sets NODE\_ENV to production during npm install --production or npm install --omit=dev, not for arbitrary npm run scripts. Relying on the implicit value leads to development builds in production or missing optimizations. Always be explicit; cross-env keeps scripts portable across shells.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-01T04:42:58.389926+00:00— report_created — created