3

I try to use node-inspector to debug my node apps. At first, I use

node-debug index.js

but the inspector wont stop at debugger statement, also I am unable to set breakpoints.

But if I run

 node-inspector

then run node with debug flags

 node --debug index.js

the inspector works like a charm.

So what is the difference between these two? I try to read https://github.com/node-inspector/node-inspector/blob/master/bin/node-debug.js but frankly no understand :O

Thank you very much!

I use mac osx 10.10.2

sayen
  • 135
  • 2
  • 7

1 Answers1

1

Basically, node-debug loads the node-inspector but also sets some default configurations.
See this statement in the docs While running node-debug is a convenient way to start your debugging session, there may come time when you need to tweak the default setup.

The full list of what it preloads is sort of hard to figure out (I don't know of any real listing of differences). But if you really go through the docs you can kind of get an idea.
node-debug

>Debug
The node-debug command will load Node Inspector in your default browser.


>The debugged process must be started with --debug-brk, this way the script is paused on the first line.
Note: node-debug adds this option for you by default.

Also, check out the config options for each one (node-debug and node-inspector)

Justin Maat
  • 1,965
  • 3
  • 23
  • 33
  • I will go check the options, if any good I will feedback here :) – sayen Apr 01 '15 at 03:09
  • I seems to find that leaky option, I add a `console.log` in node-debug.js, to print the execArgs, turns out the execArgs is just `--debug-brk`. So I try running `node --debug-brk index.js` to attach to the inspector, then I found the debugger not working, I could not set breakpoints. Run `node --debug index.js` is fine. A little bit weird. :P – sayen Apr 01 '15 at 03:34
  • anyway post an issue for them [https://github.com/node-inspector/node-inspector/issues/598](https://github.com/node-inspector/node-inspector/issues/598) : I – sayen Apr 01 '15 at 03:50