Debug application which is run using pm2

You’re almost there, use node_args instead of args:

  • args are your script arguments
  • node_args are arguments that are passed to node executable

    {
      "name": "myName",
      "script": "app.js",
      "node_args": ["--debug=7000"]
    }
    

PM2 json schema.

If someone still has problems with the debug setting after this, in some case you have to disable the cluster mode for the debug setting to be effective.

Also note that you don’t need the brackets in the node_args value if you pass all the args as a single string.

Leave a Comment