Node.js debugging

Stack overflows
It used to be hard to debug stack overflows in node, as it would just bomb without producing a stack trace. This has thankfully changed with node 0.11. It also helps to increase the stack depth to spot larger recursions:

node --stack-trace-limit=1000 

Profiling
A good tool for profiling nodejs applications is the combination of nodegrind and kcachegrind.

Quick start:

npm install -g nodegrind nodegrind  Profile written to "callgrind.out.8004" Try `kcachegrind "callgrind.out.8004"` kcachegrind callgrind.out.8004