Debugging NodeJs Using Chrome / Chromium Debugger

Chrome Browser (aka Chromium) has a powerful debugger built in. This lets you step through code, examine variables, set breakpoints, evaluate expressions and so on, all within your live program or app.

Feel free to post tips, request for help, ask how to do stuff on this topic.

To use the debugger:

  • install Chromium (or Chrome) Browser
  • start Chromium (or Chrome)
  • get rid of the rude login dialog (I never use it)
  • paste the following into the address bar: chrome://inspect/#devices
  • click Open dedicated DevTools for Node
  • start your program node js program (e.g. bin.js) with the command node --inspect bin.js or node --inspect-brk bin.js (the first form runs the program immediately, the second will break at the start, so press F8 when you want to run it).

When you start the debugger should open immediately, and you can browse source, set breakpoints and so on from there.

4 Likes