Skip to content

Conversation

@arthurfiorette
Copy link

Node.js runs normally when the env file cannot be found. I think this behavior is good to be documented.

echo 'console.log(process.env)' > test.js;
echo 'A=1' > .env;

# does not prints A: '1'
node --env-file=not-found-env-file.env test.js;
node --env-file=not-found-env-file.env -e 'console.log(process.env)';

# prints A: '1'
node --env-file=.env test.js;
node --env-file=.env test.js -e 'console.log(process.env)';

@nodejs-github-bot nodejs-github-bot added cli Issues and PRs related to the Node.js command line interface. doc Issues and PRs related to the documentations. labels Nov 14, 2023
Copy link
Member

@anonrig anonrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't apply anymore. Ref: #50588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Issues and PRs related to the Node.js command line interface. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants