/ development

Debugging Node.js

Node.js has a great debugger, node-inspector. Its extremely easy to use. Just run node-debug <start script> and then head to the url that it specifies. By default, it will tell you to connect to but, it will listen on all the interfaces at the specified port. Then all you have to do is connect with Chrome. Its unfortunate but, its not too onerous of a requirement. It will work even if the node process is running on a different machine. Once connected, you have all of the tools you could want from a debugger. The stack traces aren't always helpful due to the asynchronous nature of node.js.

This is in stark contrast to the other debugger that I use at my job, xdebug. Xdebug doesn't have a built in interface. It requires you to provide your own interface. I've tried quite a number of them but, I've only found one that is actually usable PHPStorm/idea (which are both great). Heres the thing, node-inspector is about even with the quality of Jetbrain's products without the need to load a full ide.