Search code examples
pm2

How to pass N parameters / arguments to pm2?


I need to start my node with pm2 passing 2 paremeters: the config file and the port number

Equivalent to

node server.js ./config.json 9000

I tried that:

pm2 start server.js --name server1 -- ./config.json -- 9000

The second parameter is never passed. Any idea ?


Solution

  • Try like this below without -- parameter on each argument. After first -- parameter we can pass multiple arguments by space seperated.

    pm2 start server.js --name server1 -- ./config.json 9000