Is there a command line argument or an environment variable that disables the "break on first line" feature of the node debugger?
Just Delete the . vscode file from the directory you are working in and reopen the window the debugger will be gone.
To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.
When debugging in Node. js, we add a breakpoint by adding the debugger keyword directly to our code. We can then go from one breakpoint to the next by pressing c in the debugger console instead of n . At each breakpoint, we can set up watchers for expressions of interest.
A minimal CLI debugger is available with node inspect myscript. js . Several commercial and open source tools can also connect to the Node. js Inspector.
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:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With