How to disable in the node debugger "break on first line"

Is there a command line argument or an environment variable that disables the "break on first line" feature of the node debugger?


There are actually two debugger concepts in node: V8 debugger (with its TCP-based protocol) and a node command-line debugger (CLI).

When you run node debug app.js, a debugger CLI is run in the master node process and a new child node process is spawned for the debugged script (node --debug-brk app.js). The option --debug or --debug-brk is used to turn on V8 debugger in the child process.

The difference between --debug and --debug-brk is that the latter one adds a breakpoint on the first line, so that execution immediately stops there.

I would suggest you this solution:

  1. When you are creating a child process from your webserver, run node --debug instead of node debug. This way there is only one child process created, it is running your application and it is not paused on the first line.

  2. Now you can use any debugging tool that supports V8 debugger protocol - node built-in CLI debugger, node-inspector or you can event implement your own debugger front-end (GUI) if you like. (I presume this is what you are trying achieve by running CLI debugger in background?)

    If you decided to use built-in CLI, just spawn another another child process and tell node CLI debugger to connect to the process started in step 1:

    node debug localhost:5858

    and continue as before.


According this issue I have opened in the node repo, currently, this is not possible. This is also something that the node guys don't see as a feature worth implementing "because it seems kind of pointless. […] Attaching to a running process does exactly" the same thing. See the rest of the discussion in the mentioned issue.

If you think you want such a feature, vote this up, leave a comment in the Github issue, and, if no response, open a new one and post it here as well.