Skip to content

Instantly share code, notes, and snippets.

@adunkman
Created August 20, 2012 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adunkman/3398835 to your computer and use it in GitHub Desktop.
Save adunkman/3398835 to your computer and use it in GitHub Desktop.
Debugging Node.js Applications

Packages reviewed

  1. node-inspector
  2. node-webkit-agent
  3. node-codein

node-inspector

Setup

  1. npm install -g node-inspector
  2. node --debug server.js
  3. node-inspector
  4. Navigate to http://localhost:8080/debug?port=5858

Thoughts

  • Surprisingly slow
  • Full Chrome debugger (breakpoints, inspecting on hover, watching, call stacks, etc).

node-webkit-agent

Setup

  1. { devDependencies: "node-webkit-agent": 0.0.4 }
  2. npm install
  3. require("node-webkit-agent");
  4. node server.js
  5. kill -SIGUSR2 <node pid>
  6. Navigate to http://c4milo.github.com/node-webkit-agent/19.0.1084.46/inspector.html?host=localhost:1337&page=0 (0.6.x) or http://c4milo.github.com/node-webkit-agent/21.0.1180.57/inspector.html?host=localhost:8080&page=0 (0.8.x)

Thoughts

  • Implements the webkit developer tools protocol
  • Author of node-inspector (Danny Coates) wants you to use it
  • Not fully implemented (by far). Implements CPU and Heap profiling, but not "normal" debugging tools.

node-codein

Setup

  1. { devDependencies: "node-codein": "1.0.1" }
  2. npm install
  3. require("node-codein");
  4. node server.js
  5. Navigate to http://localhost:55281

Thoughts

  • That's it? Only a console.
  • Slow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment