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
dotenv
library and load your INI style.env
files as Nodejs flagUnfortunately, the most naive and straightforward way is not supported (yet I hope)
So the only way to run
ts-node
with support of--env-file
flag is:with
ts-node
locally 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.ts
throws
--env-file is not allowed in NODE_OPTIONS
Beta Was this translation helpful? Give feedback.
All reactions