3

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 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

What am I doing wrong?

az2902
  • 418
  • 6
  • 18

1 Answers1

4

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))

{
  "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

Mikko
  • 1,877
  • 1
  • 25
  • 37
  • is it not possible to do this via CLI? I really don't want to do this via a json file. – az2902 Sep 28 '17 at 23:22
  • Check out these docs for doing it via CLI: https://futurestud.io/tutorials/pm2-how-to-start-your-app-with-node-js-v8-arguments – cody Dec 21 '17 at 14:51