-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--env-file-if-exists throws error when the .env file doesn't exist and when combined with --watch #56887
Comments
Interesting... |
As `--env-file` is experimental, this must be marked as experimental as well. Refs: nodejs#56887 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
This seems to be fixed in upstream. ./node --env-file-if-exists=.env --watch main.js
.env not found. Continuing without it.
.env not found. Continuing without it.
Hola mundo
Completed running 'main.js' Thanks for this report, please make sure you use LTS releases. See https://github.com/nodejs/release?tab=readme-ov-file#release-schedule This bug is fixed in v22.13.1. $ node -v
v22.13.1
$ node --env-file-if-exists=.env --watch main
.env not found. Continuing without it.
.env not found. Continuing without it.
Hola mundo
Completed running 'main' I'll proceed to close this issue as it is fixed and released |
Thanks for looking into it. I was using latest (23) because of the removal of the --experimental-strip-types flag and never even tried with LTS - that was a terrible oversight of mine. Too excited to run those ts files! |
Please be careful :) |
As `--env-file` is experimental, this must be marked as experimental as well. Refs: nodejs#56887 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: nodejs#56893 Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
@juanarbol rather than pushing users off of Current releases (we want users to use Current releases, it's the whole point of having them), it would more useful to use the report to tag the relevant folks and make sure the bug doesn't make its way into an LTS release – which has happen, see #57040 |
Version
23.7.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Run any script in a project where a .env file doesn't exist:
If the .env file exists or you don't use the
--watch flag
, script runs normally without throwing errors.How often does it reproduce? Is there a required condition?
These need to be true for the problem to occur:
--env-file-if-exists
pointing to a non existing .env file,--env-file-if-exists=.env
--watch
What is the expected behavior? Why is that the expected behavior?
Script should run normally with the following message being printed right before it:
What do you see instead?
An error stating .env was not found.
Additional information
Neither
--watch
nor--env-file
/--env-file-if-exists
documentations warn about not combining these flags.The text was updated successfully, but these errors were encountered: