Passing --node-args --inspect to pm2 with process file

Viewed 2416

I'm currently using pm2 with a process file as such:

pm2 start ecosystem.config.js

I would like to pass in the --inspect flag in order to start the node inspector. However, doing this doesn't work:

pm2 start ecosystem.config.js --node-args="--inspect"

This page http://pm2.keymetrics.io/docs/usage/application-declaration/#considerations mentions

All command line options passed when using the JSON app declaration will be dropped i.e.

Is this the reason that this isn't working. Does anyone know why?

Is there a way to pass in the the --inspect flag without adding it to the process file? I'm aware that adding the node_args property to the process file work. I'm trying to figure out if there's a way to get CLI option to work.

1 Answers

According to the docs you should be able to do this:

pm2 start ecosystem.config.js -- --inspect

Quoting:

Pass extra arguments to the script

-- arg1 arg2 arg3

Related