You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--env-file and --env-file-if-exists are disallowed in NODE_OPTIONS #66560
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
As normal runtime flags, these should work via the NODE_OPTIONS mechanism, as that's the only way to ensure Node uses the correct env when invoking tooling with their own bin scripts via npm scripts, npx, etc. (notably, it means you can't cleanly load an .env file for common tooling like playwright, webpack, etc) without using the long-dead "node ./node_modules/.bin/..." way of invoking node based tooling.
What do you see instead?
Node throws a parse error:
node: --env-file= is not allowed in NODE_OPTIONS
Additional information
When the env file mechanism was flipped from experimental to baseline, no update to the NODE_OTIONS parser was made to allow these flags to be set, which was an oversight.
Note that #51147 never really concluded, with an unexplained note from 2024 that this would be hard, given the code at the time (and a promise of follow-up that never materialized =).
It is several years later now, and the feature is no longer experimental but baseline, so this is not so much a duplicate as it is a "some years have passed, --env-file and --env-file-if-exists officially made it in, so they should be acceptable NODE_OPTIONS" =)
Activity
akasakariko commentedon Oct 7, 2026
I'd like to work on this
inoway46 commentedon Oct 7, 2026
This appears to be the same feature request as #51147.
Pomax commentedon Oct 7, 2026
Note that #51147 never really concluded, with an unexplained note from 2024 that this would be hard, given the code at the time (and a promise of follow-up that never materialized =).
It is several years later now, and the feature is no longer experimental but baseline, so this is not so much a duplicate as it is a "some years have passed,
--env-fileand--env-file-if-existsofficially made it in, so they should be acceptableNODE_OPTIONS" =)