Repository navigation
--env-file support in NODE_OPTIONS #51147
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Dec 13, 2023 Well, that can raise many issues and confusion since you can define NODE_OPTIONS inside the env file
Reacted by Juan José and Aviv KellerReacted by ShahriarI see, but I see no other solution for project specific
.env, right? Do we have a way of knowing where the NODE_OPTIONS are coming from? If so, just disabling it for the.envrecursive case might be a way? 🤔- addeddotenvIssues and PRs related to .env file parsing.Issues and PRs related to .env file parsing.
on Jan 18, 2024 Well, that can raise many issues and confusion since you can define NODE_OPTIONS inside the env file
Not really. Command line switches take priority over all other methods of defining the same values. Just ignore any
NODE_OPTIONSin the env file when it is being loaded by--env-file. The current state of rejecting the option is frustrating and surprising.Reacted by Rodrigo Bastos, Christopher Monsanto, Sergey Kozlov, Bit0r, Graham Ballantyne and avernikozI think this was working before version 20.12.x (related issue: remy/nodemon#2194).
I think this was working before version 20.12.x (related issue: remy/nodemon#2194).
Not a related issue. They've opened an issue that is not related to nodemon at all (just to prevent confusion for anyone else)
Reacted by James SumnersClosing since technically this is not possible with the current implementation.
Reacted by Graham BallantyneCan you please highlight what makes it "technically impossible"?
Reacted by Graham BallantyneReacted by Yagiz NizipliCan you please highlight what makes it "technically impossible"?
With the current state it is not possible, I didn't say impossible :-)
To summarize, if you refactor how we load and initialize node options as well as env file, it is possible. although, i think it will make both implementations more complex with little gain. if you think you can land it, with less unmaintainability, PRs are welcome.
Reacted by Bit0rReacted by James Sumners and Graham Ballantyne@anonrig you seem to have direct knowledge of why it is impossible. I am asking you to provide a summary of that knowledge. As a reader of this thread, there is nothing in it that tells me why it would be closed without being solved.
@anonrig you seem to have direct knowledge of why it is impossible. I am asking you to provide a summary of that knowledge. As a reader of this thread, there is nothing in it that tells me why it would be closed without being solved.
You're right. I'll write an in depth analysis of my thoughts when I have the time. Meanwhile, I'm reopening the issue.
Reacted by James Sumners, Erfan Safari, Rogério Vicente, Graham Ballantyne, Gus and Jonathan RaoultThis seems to be the closest I have found to my task. Perhaps someone here can give me a hint?
I want to use
--env-file(--env-file-if-existstbh) together with running npm package. Moreover, I want to get this cross-platform and without using third-party packages.I think I got closer to it with
npxand here I am:npx --node-options='--env-file-if-exists=.env' playwright test node: --env-file-if-exists= is not allowed in NODE_OPTIONSPerhaps there is another way?
Reacted by Cameron Cadiz, Gus, Lucas Recknagel, Damien Maillard, Aleksi Pekkala, Pierre Penelon, Wojciech Maj and Jakub Zomerfeldgithub-actions commented
on May 28, 2025 on May 28, 2025 – with GitHub ActionsContributorMore actionsThere has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-stale
Issues and PRs exempt from automated stale handling. label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.Reacted by Damien Maillard, James Sumners, Vladyslav Zubko, Brendon Matos, whoisYeshua, Kendell, Pierre Penelon, Graham Ballantyne and Hiroki Osame- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on May 28, 2025 @anonrig you seem to have direct knowledge of why it is impossible. I am asking you to provide a summary of that knowledge. As a reader of this thread, there is nothing in it that tells me why it would be closed without being solved.
You're right. I'll write an in depth analysis of my thoughts when I have the time. Meanwhile, I'm reopening the issue.
any updates?
Reacted by Graham Ballantyne, Jakub Zomerfeld and Cristian Torres
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriaged
What is the problem this feature will solve?
Sometimes env files are used as config files, therefore it should be allowed to set an
--env-fileinNODE_OPTIONS, for example in the.npmrcfile, so that it applies to all scripts of that specific project.What is the feature you are proposing to solve the problem?
Allowing for the
--env-fileflag to be supported inNODE_OPTIONS.What alternatives have you considered?
No response