Successfully reported this slideshow.

Node.js debugging

16

Share

Loading in …3
×
1 of 14
1 of 14

Node.js debugging

16

Share

Download to read offline

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.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Node.js debugging

  1. 1. Pittsburgh http://www.meetup.com/Pittsburgh-Node-js/ Last Wednesday of every month 7-9pm Right here at LeBrew House!
  2. 2. Nicholas McClay Designer and Developer @nickmcclay
  3. 3. Debugging goodbye console.log()
  4. 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 we'll see later This hook to V8's debugger is what all Node debug tools bind to.
  5. 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. 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 debugger's repl for evaluation in debugging script's context • Execution control – run - Run script (automatically runs on debugger's start) – restart - Restart script – kill - Kill script
  7. 7. Can’t we use something a little less… Arcane? Unusual? Ugly? 1990?
  8. 8. Eclipse IDE Eclipse Node Debugger Walk Through: https://github.com/joyent/node/wiki/Using- Eclipse-as-Node-Applications-Debugger Chrome Dev Tools + V8 Debugger: http://code.google.com/p/chromedevtools/ Warning, plug-in compatibility can be a nightmare! Aptana or other highly customized Eclipse based IDE's may not work.
  9. 9. Eclipse advanced debugging To debug with real source instead of 'VirtualProject' files http://code.google.com/p/chromedevt ools/wiki/FeatureDebugOnRealFiles Screen capture of setup http://www.youtube.com/watch?v=GV xFFw7lkYg
  10. 10. Webstorm IDE Happy Node.js debugging right out of the box! Coffeescript debugging coming in version 4.0!
  11. 11. Other IDEs Komodo IDE
  12. 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-inspector 2.) node --debug-brk test.js 3.) node-inspector 4.) Open browser to http://localhost:8080/debug?port=5858
  13. 13. Final Thoughts • --debug vs --debug-brk • Remote Debugging • Long stack traces http://stackoverflow.com/questions/7697038/more- than-10-lines-in-a-node-js-stack-error
  14. 14. Thanks! Questions?

×