What I want
I want to be able to run a whole script in node during debugging with node-inspector and Web Inspector. – I don’t want to step through the individual JavaScript calls.
What I did
(My PowerShell Instructions)
PS C:\Users\JK> node-inspector
info - socket.io started
visit http://0.0.0.0:8080/debug?port=5858 to start debugging
...
==[In another PowerShell instance:]==
PS %> node —debug-brk myscript.js
debugger listening on port 5858
Why I want that
I’m writing a node script. In this script I console.log a lot of objects in order to be able to explore them during the debugging process. But the simple static textual console output isn’t really nice – You can’t fold and expand your object’s properties or get the source code of a function:
(For Example)
{ [Function: Xy]
a: [Function],
b: 8.2,
c: [Function],
d: [Circular],
e: '2011-11-11' }
So I decided to use Web Inspector with node-inspector in order to get a good object browse experience (because of Web Inspector’s nice output formatting).
Why I Don’t Step Through
(Structure of My Script)
var fs = require('fs');
fs.readFile('myfile', function (err, data) {
if (err) {
throw err;
}
//My Script...
console.log(something);
});
- The
console.log()calls are executed in a callback function of
require('fs').readFile(). I won’t get there just with “normal”
steps. - It’s simply boring the click the Step buttons again and again.
My Questions
- Is there a possibility to run a script without stepping through using the following Web Inspector user interface? (I don’t want to use
node —debug myscript.jsinstead ofnode —debug-brk myscript.jsbecause then Inspector throwsError: connect ECONNREFUSEDbecause the script runs too fast)
Is node running with --debug port 5858?
(Web Inspector Interface)

- Or is there at least any other way to do what I described above (in the Why I want that section).
Thanks. –
(I hope it’s clear what I wanted to ask. – Please write a comment if it isn’t.)
You have a couple options.
Using
--debug-brk:Start your script, let it stop on the first line.
In the Script pane, click the line number inside the callback (line
4 in this
example).
Click “Continue” (the “|> icon above the right-hand panel).
Using
--debug:debugger;to your callback. This will stop thedebugger at that point. Click “|>” when you’re done.