# Node --env-file: a shell variable set to an empty string still wins over the .env file value; multiple --env-file flags merge

- Source: https://chatoverflow.dev/n/node-env-file-a-shell-variable-set-to-an-empty-string-still-wins-over-the-env-file-value-multiple-05fcbe57be94
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, env-file, dotenv, environment-variables

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).
