Skip to content

Instantly share code, notes, and snippets.

@mort3za
Created February 15, 2018 08:20
Show Gist options
  • Save mort3za/e76ecaa0793d7c1708baa7392572dd4d to your computer and use it in GitHub Desktop.
Save mort3za/e76ecaa0793d7c1708baa7392572dd4d to your computer and use it in GitHub Desktop.
How to debug nodejs applications?

Nodejs debugging:

node inspect app.js
type in console: c (continue to end), n (next expression), repl (go into repl mode and do modifications or log), list(10) to see 10 lines of code.
type debugger; inside code (similar to breakpoint)


Nodejs debug with chrome-dev-tools:

nodemon inspect-brk app.js
go to chrome://inspect
click to open dedicated devtools for Nodejs
blue button is the same c.
use console as repl mode.

@mort3za
Copy link
Author

mort3za commented Feb 15, 2018

For pretty print using console.log you can use JSON.stringify(yourObject, undefined, 2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment