Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are actually two debugger concepts in node: V8 debugger (with its TCP-based protocol) and a node command-line debugger (CLI).</p> <p>When you run <code>node debug app.js</code>, a debugger CLI is run in the master node process and a new child node process is spawned for the debugged script (<code>node --debug-brk app.js</code>). The option <code>--debug</code> or <code>--debug-brk</code> is used to turn on V8 debugger in the child process.</p> <p>The difference between <code>--debug</code> and <code>--debug-brk</code> is that the latter one adds a breakpoint on the first line, so that execution immediately stops there.</p> <p>I would suggest you this solution:</p> <ol> <li><p>When you are creating a child process from your webserver, run <code>node --debug</code> instead of <code>node debug</code>. This way there is only one child process created, it is running your application and it is not paused on the first line.</p></li> <li><p>Now you can use any debugging tool that supports <a href="https://code.google.com/p/v8/wiki/DebuggerProtocol">V8 debugger protocol</a> - node built-in CLI debugger, <a href="https://github.com/dannycoates/node-inspector">node-inspector</a> 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?)</p> <p>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:</p> <p><code>node debug localhost:5858</code></p> <p>and continue as before.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload