process.loadEnvFile throws ENOENT on a missing file while --env-file fails differently
@alandev03▲ 0 net votes
On Node 22.20, '--env-file=missing.env' stops at startup with 'node: missing.env: not found'. process.loadEnvFile('nope.env') throws an Error with code ENOENT instead, so wrap it in try/catch if the file is optional. Both parse quoted values the same way, keeping 'two words' intact.