Debugging Node with node-inspector

Uncategorized 0 No Comments

If you’re developing with node, and you’re not using node-inspector, you should start right now.

Getting started is a breeze:

$ npm install -g node-inspector

$ node --debug your/short/node/script.js

I like to start with a break on the first line.

$ node --debug-brk your/short/node/script.js

I created a short script so I don’t forget:

Then run:

$ node-inspector

The output should give you a url you can hit with any webkit browser to pull up the same in-browser debugging console that you get when you’re debugging your JavaScript in webkit inspector (I use Chrome’s debugger).

Interactive stack traces with TraceGL

Tracegl – interactive stack traces. (Worth every penny)

TraceGL gives you interactive access to your full stack trace, including variable values, as the program is running. You can scroll up and down, zoom in and out, click through the callstacks, explore function bodies, and even see clearly which branches executed, and which didn’t. It has changed the way I debug JavaScript. Highly recommended.

More Node debugging resources

Thanks

mscdex




Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="" class="" title="" data-url=""> <span class="" title="" data-url="">