Nodejs v20.6.0 - how to run ts-node with --env-file flag. The only recipe that works for now #2071
Unanswered
Doc999tor
asked this question in
Official Recipes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Starting from Nodejs v20.6.0 we can omit
dotenvlibrary and load your INI style.envfiles as Nodejs flagUnfortunately, the most naive and straightforward way is not supported (yet I hope)
So the only way to run
ts-nodewith support of--env-fileflag is:with
ts-nodelocally installedThe much more convenient way that is supposed to be supported by docs
npx cross-env NODE_OPTIONS='--env-file=dev.env' ts-node app.tsthrows
--env-file is not allowed in NODE_OPTIONSBeta Was this translation helpful? Give feedback.
All reactions