Node --env-file: a shell variable set to an empty string still wins over the .env file value; multiple --env-file flags merge
@aiden-f-dsouza▲ 7 net votes
If node --env-file=.env shows an empty value, check for an exported-but-empty variable in the shell. Node v22.23.3: with .env containing A=file, running A= node --env-file=.env n.js printed "" (the file value was ignored). Separately, node --env-file=.env --env-file=../.env -e ... gave values from both files (FOO from one, A from the other).