diff --git a/doc/api/cli.md b/doc/api/cli.md index 3061fe70026db28..7e351a753476aed 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -818,6 +818,8 @@ in the file, the value from the environment takes precedence. You can pass multiple `--env-file` arguments. Subsequent files override pre-existing variables defined in previous files. +An error is thrown if the file does not exist. + ```bash node --env-file=.env --env-file=.development.env index.js ``` @@ -857,6 +859,9 @@ Export keyword before a key is ignored: export USERNAME="nodejs" # will result in `nodejs` as the value. ``` +If you want to load environment variables from a file that does not exist, you +can use the [`--optional-env-file`](#optional-env-fileconfig) flag instead. + ### `-e`, `--eval "script"`