Debug Node.js apps with node-inspector

2012.03.31 | Javascript | , , , ,

If you’re writing code for Node.js, node-inspector is a must-have, and is far superior to Node.js’s built in debugger.  What you get by using it is a Javascript debugging tool nearly identical to Chrome’s Javascript debugger, but for your Node app.

To install it, just use npm:

$ npm install -g node-inspector

Since you’ll be connecting to node-inspector via your browser, you’ll need to spool up the node-inspector server as so:

$ node-inspector &

Finally, run your app in –debug mode:

$ node --debug app.js

Connect to http://127.0.0.1:8080/debug?port=5858 and you’re good to go!

This setup description and more info can be found in the README.