SlideShare a Scribd company logo
1 of 14
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

Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming  Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
Amit Thakkar
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
偉格 高
 

What's hot (20)

Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming  Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 
Nodejs intro
Nodejs introNodejs intro
Nodejs intro
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Node azure
Node azureNode azure
Node azure
 
Node.js Crash Course
Node.js Crash CourseNode.js Crash Course
Node.js Crash Course
 
Node ppt
Node pptNode ppt
Node ppt
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013
 

Similar to Node.js debugging

Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
mpaproductions
 

Similar to Node.js debugging (20)

introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL Server
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developers
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Intro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio CodeIntro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio Code
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
Re-checking the ReactOS project - a large report
Re-checking the ReactOS project - a large reportRe-checking the ReactOS project - a large report
Re-checking the ReactOS project - a large report
 
TestUpload
TestUploadTestUpload
TestUpload
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
WebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET CoreWebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET Core
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Node.js debugging

  • 1. Pittsburgh http://www.meetup.com/Pittsburgh-Node-js/ Last Wednesday of every month 7-9pm Right here at LeBrew House!
  • 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