Debugging Node/Express --- require('express') creates a break Debugging Node/Express --- require('express') creates a break express express

Debugging Node/Express --- require('express') creates a break


There is a popular GUI debugger (leveraging WebKit, i.e. Chrome, Safari..).

You should give it a go https://github.com/dannycoates/node-inspector


Just echoing the call for Node Inspector with a bit more explicitness.

$ sudo npm install -g node-inspector$ node-debug app.js <arguments to your app>debugger listening on port 5858Node Inspector is now available from http://localhost:8080/debug?port=5858Debugging `app.js`

Now in (a webkit-based?) browser go to that address - or it works just fine remotely too, as long as the ports are open.

enter image description here

Now you have full access to all the server side variables (the app object for instance), exposed to the client side debugger. It's quite magical. You can set breakpoints at app.get() entry points, or at server init, or wherever.


Personally, I prefer to use a combination of node-inspector with old-fashioned console.log statements to figure out what's going on. (I don't think v8-profiler, mentioned by node-inspector, works with Node 0.6.x, but to be honest I haven't tried.)

If someone else has a better-maintained tool for debugging Node.js apps, I'd love to hear of it, too, but this is the best that I know of.