Description
What is the problem this feature will solve?
Greetings! Thanks a lot for implementing --env-file
directly into Node.
I am currently using Node v20.9.0 on Linux, and if you run node
with the --env-file
option that points to a file that can't be reached, it still will execute the program as if everything went fine. For example:
node --env-file=non_existing_file.env my_app.js
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-file
instead.