Report #103816
[gotcha] npm lifecycle scripts rely on implicit environment variables that change between npm versions
Do not depend on npm\_package\_\* or npm\_config\_\* env vars being injected. Read package.json at runtime, explicitly pass NODE\_ENV and other config, and pin your package manager version. Test with npm ci and the same npm major version you deploy with.
Journey Context:
npm historically flattened all of package.json into npm\_package\_\* and all config into npm\_config\_\*. RFC 21 \(implemented in npm v7\+\) drastically reduced these variables, keeping only name, version, engines, main, bin, config, and a few install-specific fields. Scripts that read npm\_package\_description or npm\_config\_cache silently break after upgrading npm. PATH still gets node\_modules/.bin prepended, but relying on env magic is brittle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:45:23.963202+00:00— report_created — created