Attach the debugger
Either by port or by process id. For ports, use a different port for each process. On the command line:
node --inspect 8085 some_script_1.js
node --inspect 8086 some_script_2.js
node --inspect 9012 some_script_3.js
In a separate terminal window, you can attach to any of these processes with node inspect <host>:<port>
. For example to attach to some_script_2.js
on port 8086
node inspect 127.0.0.1:8086
Attaching to different processes is matter of changing the port, for example 9012
you would run
node inspect 127.0.0.1:9012
If you didn't start node on a separate, known port, you can also use the -p
flag to attach directly to an existing process
node inspect -p <node_script_process_id>
On Linux and Mac OS use ps -A | grep node
to find node process ids. Once a process is started, you can also attach the inspector by sending signal to the node process SIGUSR1
Reference
The node-inspect
program (source) is separate from core node. Though it is bundled with nodejs. Node inspect reimplements node debug to address a limitation
For Chrome inspector protocol, there's only one: node --inspect ... This project tries to provide the missing second option by re-implementing node debug against the new protocol.
Debugger API documenation
Additional Ways to Attach Debugger
https://nodejs.org/en/docs/guides/debugging-getting-started/
You can view an interact with the debugger in Chrome. Just add additional connections under the Connections
tab of the dedicated NodeJS DevTools window.

Similar, but Separate, Projects
Worth noting there is a similar project, now deprecated, that is called node-inspector
, which is separate from node-inspect
Tested October, 2018 with node v10.11.0