SlideShare a Scribd company logo
Pittsburgh
 http://www.meetup.com/Pittsburgh-Node-js/




Last Wednesday of every month 7-9pm
      Right here at LeBrew House!
Nicholas McClay
Designer and Developer




     @nickmcclay
Debugging
goodbye console.log()
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.
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)
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
Can’t we use something a little less…




   Arcane? Unusual? Ugly? 1990?
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.
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
Webstorm IDE
Happy Node.js
debugging right out
of the box!

Coffeescript
debugging coming in
version 4.0!
Other IDEs




Komodo IDE
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
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
Thanks!

Questions?

More Related Content

What's hot (20)

PDF
Introduction to Node.js: What, why and how?
Christian Joudrey
 
PDF
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
PPTX
Introduction to Node.js
Vikash Singh
 
PPTX
Introduction to Node js
Akshay Mathur
 
PPTX
introduction to node.js
orkaplan
 
PPTX
Introduction to node.js GDD
Sudar Muthu
 
PDF
All aboard the NodeJS Express
David Boyer
 
PPTX
Nodejs intro
Ndjido Ardo BAR
 
PPTX
Java script at backend nodejs
Amit Thakkar
 
PDF
Use Node.js to create a REST API
Fabien Vauchelles
 
PDF
NodeJS for Beginner
Apaichon Punopas
 
KEY
Writing robust Node.js applications
Tom Croucher
 
PPTX
Node js introduction
Joseph de Castelnau
 
PDF
Node azure
Emanuele DelBono
 
PDF
Node.js Crash Course
David Neal
 
PDF
Node ppt
Tamil Selvan R S
 
PPTX
NodeJS - Server Side JS
Ganesh Kondal
 
PDF
Module, AMD, RequireJS
偉格 高
 
PDF
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Ivan Loire
 
PPTX
Node.js, for architects - OpenSlava 2013
Oscar Renalias
 
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
Introduction to Node.js
Vikash Singh
 
Introduction to Node js
Akshay Mathur
 
introduction to node.js
orkaplan
 
Introduction to node.js GDD
Sudar Muthu
 
All aboard the NodeJS Express
David Boyer
 
Nodejs intro
Ndjido Ardo BAR
 
Java script at backend nodejs
Amit Thakkar
 
Use Node.js to create a REST API
Fabien Vauchelles
 
NodeJS for Beginner
Apaichon Punopas
 
Writing robust Node.js applications
Tom Croucher
 
Node js introduction
Joseph de Castelnau
 
Node azure
Emanuele DelBono
 
Node.js Crash Course
David Neal
 
NodeJS - Server Side JS
Ganesh Kondal
 
Module, AMD, RequireJS
偉格 高
 
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Ivan Loire
 
Node.js, for architects - OpenSlava 2013
Oscar Renalias
 

Similar to Node.js debugging (20)

PDF
FITC - Here Be Dragons: Advanced JavaScript Debugging
Rami Sayar
 
PDF
Here Be Dragons – Advanced JavaScript Debugging
FITC
 
PDF
Web a Quebec - JS Debugging
Rami Sayar
 
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
PDF
Node36
beshoy semsem
 
PDF
🚀 Node.js Simplified – A Visual Guide for Beginners!
Tpoint Tech Blog
 
PDF
SWT Tech Sharing: Node.js + Redis
Infinity Levels Studio
 
PPTX
Nodejs Session01
Jainul Musani
 
PDF
Node Interactive Debugging Node.js In Production
Yunong Xiao
 
PDF
540slidesofnodejsbackendhopeitworkforu.pdf
hamzadamani7
 
PPTX
Introduction to node.js
Su Zin Kyaw
 
PDF
Node.js introduction
Prasoon Kumar
 
PDF
Debugging, a step away from the console
Adam Weeks
 
PDF
Day In A Life Of A Node.js Developer
Edureka!
 
PDF
Day in a life of a node.js developer
Edureka!
 
PPTX
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
 
PDF
Debugging secrets of the pros, for everyone
Jen Weber
 
PDF
Server-Side JavaScript Developement - Node.JS Quick Tour
q3boy
 
PDF
Introduction to Node.js
Jack Franklin
 
KEY
Dcjq node.js presentation
async_io
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
Rami Sayar
 
Here Be Dragons – Advanced JavaScript Debugging
FITC
 
Web a Quebec - JS Debugging
Rami Sayar
 
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
🚀 Node.js Simplified – A Visual Guide for Beginners!
Tpoint Tech Blog
 
SWT Tech Sharing: Node.js + Redis
Infinity Levels Studio
 
Nodejs Session01
Jainul Musani
 
Node Interactive Debugging Node.js In Production
Yunong Xiao
 
540slidesofnodejsbackendhopeitworkforu.pdf
hamzadamani7
 
Introduction to node.js
Su Zin Kyaw
 
Node.js introduction
Prasoon Kumar
 
Debugging, a step away from the console
Adam Weeks
 
Day In A Life Of A Node.js Developer
Edureka!
 
Day in a life of a node.js developer
Edureka!
 
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
 
Debugging secrets of the pros, for everyone
Jen Weber
 
Server-Side JavaScript Developement - Node.JS Quick Tour
q3boy
 
Introduction to Node.js
Jack Franklin
 
Dcjq node.js presentation
async_io
 
Ad

Recently uploaded (20)

PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Digital Circuits, important subject in CS
contactparinay1
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Ad

Node.js debugging

  • 2. Nicholas McClay Designer and Developer @nickmcclay
  • 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. 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 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. Can’t we use something a little less… Arcane? Unusual? Ugly? 1990?
  • 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. 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. Webstorm IDE Happy Node.js debugging right out of the box! Coffeescript debugging coming in version 4.0!
  • 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. 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