我在 package.json
中有一个脚本,它在使用标准 .env
文件时按预期运行。
"scripts": {
"commands": "ts-node-dev --files deploy-commands.ts",
},
但是当我尝试指定不同的 .env 文件 (.env.prod
)
"scripts": {
"commands": "dotenv -e .env.prod ts-node-dev --files deploy-commands.ts",
},
我收到错误:
ts-node-dev: no script to run provided
最佳答案
根据the dotenv-cli documentation如果您想将标志传递给内部命令,则需要使用 --
。对于您的情况,以下内容应该有效:
dotenv -e .env.prod -- ts-node-dev --files deploy-commands.ts
关于typescript - ts-node-dev:使用 dotenv 时没有提供要运行的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71919562/