-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Throw an error or output a warning when --env-file can not be opened.Β #50536
Copy link
Copy link
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
What is the problem this feature will solve?
Greetings! Thanks a lot for implementing
--env-filedirectly into Node.I am currently using Node v20.9.0 on Linux, and if you run
nodewith the--env-fileoption that points to a file that can't be reached, it still will execute the program as if everything went fine. For example:What is the feature you are proposing to solve the problem?
This is not an uncommon scenario that you can find yourself in, and it can occur for various reasons. For example if you are working in a monorepository and the context of the current working directory changes, or if you lack sufficient permissions to open the file.
I think it would be beneficial for developers if an error or a warning was shown if the env file can't be opened.
What alternatives have you considered?
I have been using the dotenv package and currently in the process of migrating to native
--env-fileinstead.