Search code examples
node.jsnode-inspector

Using Node Inspector with multiple node processes


I started using Node Inspector to debug some of my Node applications. However, one thing i am not sure how to do is, once Node-inspector is attached to one Node app, how to detach and attach it to another Node app running on same box?

How can I debug multiple processes at the same time?


Solution

  • Update: If you are reading this in 2019, the below answer is out of date. You'd probably want to check out the current documentation or follow gtzilla answer: https://nodejs.org/en/docs/guides/debugging-getting-started/

    First, start your node programs with different debug ports like so:

    $ node script1.js --debug==5858
    $ node script2.js --debug==5859
    

    Then start node-inspector

    $ node-inspector &
    

    and open the web console in two tabs with

    1. http://localhost:8080/debug?port=5858
    2. http://localhost:8080/debug?port=5859