简体   繁体   English

pm2 更改 dotenv/config 路径

[英]pm2 change dotenv/config path

pm2 start --node-args="-r dotenv/config" node_modules/react-scripts/bin/react-scripts.js --name app -- start dotenv_config_path=.env.$NODE_ENV

this script works这个脚本有效

i want this one to work as well:我希望这个也能正常工作:

pm2 start ecosystem.json --env env_development

where the dotenv_config_path is inside the env variables inside the ecosystem file.其中 dotenv_config_path 位于生态系统文件内的 env 变量内。

tried adding the dotenv_config_path inside the env variables and setting the env variables using --env env_development尝试在 env 变量中添加 dotenv_config_path 并使用 --env env_development 设置 env 变量

Try adding node_args to your ecosystem file.尝试将node_args添加到您的生态系统文件中。 For example:例如:

{
    "apps": [{
        "name": "development",
        "script": "./src/bin/index.js",
        "node_args": '-r dotenv/config dotenv_config_path=.env.dev',
    }]
}

That might work for you.那可能对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM