Tuesday, February 19, 2013

node-inspector module for nodejs application debugging

I have found this very useful nodejs module: node-inspector. Node Inspector is a debugger interface for nodeJS using the WebKit Web Inspector.

Here follows screenshot of running node-inspector debugging session:

You install node-inspector with the following command:

> npm install -g node-inspector

Start your application in debug mode like this:

> node –debug index.js
Then start node-inspector (in my case default port 8080 was already in use so I specified 9999 as my port.
> node-inspector --web-port=9999
Then open you chrome browser and point to the address that was printed by inspector then it started (in my case, http://0.0.0.0:9999/debug?port=5858 but windows did not like zeros so I modified address to the following value: http://127.0.0.1:9999/debug?port=5858)