Skip to content

src: make `--env-file` return warning when not found

Currently node --env-file throws an error. People tend to add these to their package.json and push it to git. With this proposed change, we are more in par with existing dotenv package (for not throwing an error).

With the proposed change, we are now warning the users that the env file is not found when running the CLI only. loadEnvFile() is not changed.

Alternative was to add a new flag called --env-file-optional which I'm 100% against. Ref: https://github.com/nodejs/node/pull/53060

Reverts https://github.com/nodejs/node/pull/50588

Closes https://github.com/nodejs/node/issues/50993 Closes https://github.com/nodejs/node/issues/51451

Merge request reports

Loading