Your SlideShare is downloading. ×

Node.js debugging

19,272

Published on

Pittsburgh Node.js presentation explaining the different options available for Node.js across IDEs, command line, and node modules.

Pittsburgh Node.js presentation explaining the different options available for Node.js across IDEs, command line, and node modules.

Published in: Technology, Design
1 Comment
15 Likes
Statistics
Notes
No Downloads
Views
Total Views
19,272
On Slideshare
0
From Embeds
0
Number of Embeds
45
Actions
Shares
0
Downloads
56
Comments
1
Likes
15
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Pittsburgh http://www.meetup.com/Pittsburgh-Node-js/Last Wednesday of every month 7-9pm Right here at LeBrew House!
  • 2. Nicholas McClayDesigner and Developer @nickmcclay
  • 3. Debugginggoodbye console.log()
  • 4. In the beginning there was ‘debugger’ http://nodejs.org/api/debugger.html To debug in console: node debug test.js note: debug not --debug, this is a different command well see later This hook to V8s debugger is what all Node debug tools bind to.
  • 5. Debug command highlights• Stepping – cont, next, step, out - What you think they do• Breakpoints – setBreakpoint()/sb() - Set breakpoint on current line or at statement – clearBreakpoint/clearBreakpoint()/cb(...) - clear breakpoint (duh)
  • 6. Debug command highlights• Info – backtrace/bt - Print backtrace of current execution frame – watch(expr) - Add expression to watch list – unwatch(expr) - Remove expression from watch list – watchers - List all watchers and their values – repl - Open debuggers repl for evaluation in debugging scripts context• Execution control – run - Run script (automatically runs on debuggers start) – restart - Restart script – kill - Kill script
  • 7. Can’t we use something a little less… Arcane? Unusual? Ugly? 1990?
  • 8. Eclipse IDEEclipse Node Debugger Walk Through:https://github.com/joyent/node/wiki/Using-Eclipse-as-Node-Applications-DebuggerChrome Dev Tools + V8 Debugger:http://code.google.com/p/chromedevtools/Warning, plug-in compatibility can be anightmare! Aptana or other highly customizedEclipse based IDEs may not work.
  • 9. Eclipse advanced debuggingTo debug with real source instead ofVirtualProject fileshttp://code.google.com/p/chromedevtools/wiki/FeatureDebugOnRealFilesScreen capture of setuphttp://www.youtube.com/watch?v=GVxFFw7lkYg
  • 10. Webstorm IDEHappy Node.jsdebugging right outof the box!Coffeescriptdebugging coming inversion 4.0!
  • 11. Other IDEsKomodo IDE
  • 12. node-inspector Webkit Inspector debugging https://github.com/dannycoates/node-inspector front-end JavaScript debugger reused for back-end JavaScript, what a great idea!1.) npm install –g node-inspector2.) node --debug-brk test.js3.) node-inspector4.) Open browser to http://localhost:8080/debug?port=5858
  • 13. Final Thoughts• --debug vs --debug-brk• Remote Debugging• Long stack traceshttp://stackoverflow.com/questions/7697038/more-than-10-lines-in-a-node-js-stack-error
  • 14. Thanks!Questions?

×