Say you have a helloworld.js
You can run it like so
You can also debug it with like so
node --inspect-brk helloworld.js
The –inspect-brk option will set a breakpoint on the 1st line and wait for you to attach the debugger. Otherwise your program may run through thousands of lines of code before you’re quick enough to attach the debugger and stop it. This option is available in node version 7.x+. I didn’t have it in 7.2 though, so I upgraded to 8.9.4 which had it.
Then, open your chrome browser to about:inspect. You should see something like this
Click on “Open dedicated DevTools for Node” and this will open the inspector debugger that you’re used to