3

我有一个简单的命令,运行时可以正常工作:

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

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

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

查看日志,我得到错误: node: bad option: --config=/home/ubuntu/dash/config.json

我究竟做错了什么?

4

1 回答 1

4

使用您指定参数的过程文件。例如,创建以下文件并将其命名ecosystem.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"
  }]
}

并运行它

pm2 start ecosystem.json

于 2017-09-28T22:44:53.603 回答