2

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
grabury
  • 4,797
  • 14
  • 67
  • 125

1 Answers1

4

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
Megan
  • 1,000
  • 1
  • 14
  • 44