A Quick Protip When Debugging Node with Chrome Tools

Did you know you can use Chrome tools to debug Node? You can and it’s awesome.

But, when you are using the Dev Tools Workspace feature, also normally awesome, an annoying thing can happen: You get duplicated results because it is being read out of the file system and also out of the Workspace sources. Worse yet: If you put your debugger on one of them it doesn’t work at all!

The solution is simple: Always refer to the version on the file system, eg the one circled below. The debugger works on that file (click to zoom):

If you have a very small and/or fast Node program you might run into an issue where debuggers can’t catch. The fix is to use a wait function or the –inspect-brk option.

As a final note, Paul Irish rocks.

  • 1

Leave a Comment