Dugom
Dugom

Reputation: 1

How to add arguments to pm2 file execution

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?

Upvotes: 0

Views: 919

Answers (1)

Dmytro
Dmytro

Reputation: 656

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

Upvotes: 1

Related Questions