0

I'm trying to run the cluster.js file on pm2. When the file is executed locally because two arguments 0 1 are appended after I run it with the 'node cluster.js 0 1' command, and even if I use the node-args command in pm2, I get at least an error with the 'pm2 start "cluster.js 0 1"' command and no arguments are applied. What should I do?

  • I'm Korean, and I wrote it through Google Translate, so the translation may be wrong.
Dugom
  • 1
  • Looks like a duplicate of https://stackoverflow.com/questions/28980307/how-to-pass-execution-arguments-to-app-using-pm2. Should be `pm2 start cluster.js --node-args="0 1"` – Jeremy Thille Aug 31 '21 at 09:23

1 Answers1

1

If you want to pass node arguments from CLI then

pm2 start myServer.js --node-args="--production --port=1337"

You also can add any arguments after --

pm2 start app.js -- --prod --second-arg --third-arg
Dmytro
  • 636
  • 1
  • 3
  • 18