Report #13813
[gotcha] npm config environment variables are always strings causing boolean checks to fail
Explicitly compare npm\_config\_\* values to string 'true' or parse them; never use truthiness checks like if \(process.env.npm\_config\_foo\) when the flag could be set to false.
Journey Context:
npm injects all config flags as env vars prefixed with npm\_config\_, but CLI flags like --foo=false or --no-foo become the strings "false" or "" \(empty string\), both of which are truthy in JS. This silently breaks feature flags in CI when someone sets NPM\_CONFIG\_FOO=false expecting it to be falsy. The alternative is to use a proper argv parser in the script itself, but since npm auto-injects these vars, the only safe approach is explicit string comparison against "true".
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:49:08.019064+00:00— report_created — created