Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ts-node-dev: no script to run provided when using dotenv

I have a script in package.json that runs as expected when using the standard .env file.

"scripts": {
  "commands": "ts-node-dev --files deploy-commands.ts",
},

but when I try specify a different .env file (.env.prod)

"scripts": {
  "commands": "dotenv -e .env.prod ts-node-dev --files deploy-commands.ts",
},

I get the error:

ts-node-dev: no script to run provided
like image 807
grabury Avatar asked Feb 20 '26 01:02

grabury


1 Answers

According to the dotenv-cli documentation you'll need to use -- if you want to pass flags to the inner command. In your case, the following should work:

dotenv -e .env.prod -- ts-node-dev --files deploy-commands.ts
like image 149
Megan Avatar answered Feb 22 '26 14:02

Megan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!