如何使用参数启动pm2 ?

时间:2022-10-15 21:45:13

I have a simple command that works fine when run:

我有一个简单的命令在运行时运行良好:

parse-dashboard --config /home/ubuntu/dash/config.json

However, when running it with pm2, it doesn't work:

但是,当使用pm2运行时,它不工作:

pm2 start parse-dashboard -- --config=/home/ubuntu/dash/config.json

looking at the logs, i get the error: node: bad option: --config=/home/ubuntu/dash/config.json

查看日志,我得到了错误:node: bad选项:—config=/home/ubuntu/dash/config.json

What am I doing wrong?

我做错了什么?

1 个解决方案

#1


2  

Use a process file where you specify the arguments. Create the following file and name it for example ecosystem.json (make sure the 'script' and 'cwd' (where the app will be launched) locations are correct for you))

使用指定参数的进程文件。创建以下文件并为其命名,例如生态系统。json(确保“脚本”和“cwd”(应用程序将在那里启动)位置对您是正确的)

{
  "apps" : [{
    "name"        : "parse-dashboard-wrapper",
    "script"      : "/usr/bin/parse-dashboard",
    "watch"       : true,
    "cwd"         : "/home/parse/parse-dashboard",
    "args"        : "--config /home/ubuntu/dash/config.json"
  }]
}

And run it with

并运行它

pm2 start ecosystem.json

pm2开始ecosystem.json

#1


2  

Use a process file where you specify the arguments. Create the following file and name it for example ecosystem.json (make sure the 'script' and 'cwd' (where the app will be launched) locations are correct for you))

使用指定参数的进程文件。创建以下文件并为其命名,例如生态系统。json(确保“脚本”和“cwd”(应用程序将在那里启动)位置对您是正确的)

{
  "apps" : [{
    "name"        : "parse-dashboard-wrapper",
    "script"      : "/usr/bin/parse-dashboard",
    "watch"       : true,
    "cwd"         : "/home/parse/parse-dashboard",
    "args"        : "--config /home/ubuntu/dash/config.json"
  }]
}

And run it with

并运行它

pm2 start ecosystem.json

pm2开始ecosystem.json