Debugging in Chrome DevTools and VS Code

node inspect reached your debugger; statement, but you had to type exec to inspect each variable. For November’s refund on row 6, a graphical debugger can stop on that row only and show its variables at a glance. First, delete the debugger; line from parseRow(), since breakpoints you click don’t need it.

Start the Import Paused in Chrome DevTools

The --inspect-brk option starts Node paused before the first line until a debugger connects. In a terminal in ~/donations, run:

Language: Shell
$ node --inspect-brk donations.js november.csv
Debugger listening on ws://127.0.0.1:9229/4d9e3833-3657-4ec9-bab5-0f96b29e8d99
For help, see: https://nodejs.org/learn/getting-started/debugging

The ID at the end is random. Put Node’s options between node and the filename, because anything after donations.js goes to the script, which runs with no debugger and reports no export at --inspect-brk.

While Node waits, attach Chrome:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.