3.14 Debugging via Chrome Dev Tools

This time, we are learning how to debug through Chrome.

You must have Chrome installed to continue.

We use the same material from 3.13.

We used node inspect to enter the debug mode in the command interface. For chrome, we use node --inspect-brk

If we do this, we will see

$ node --inspect-brk playground/debugging.js
Debugger listening on ws://127.0.0.1:9229/cc4b27aa-6e2a-4218-99f5-708f59b12e0c
For help see https://nodejs.org/en/docs/inspector

Now, connect via Chrome.

Alt text

Alt text

Alt text

Use nodemon with Chrome Debugging

$ nodemon --inspect-brk playground/debugging.js

Create Debugger in Chrome Dev

Alt text

Exercise

var logNote = (note) => {
debugger;
// Break on this line and use Chrome to print note
console.log('--');
console.log(`Title: ${note.title}`);
console.log(`Body: ${note.body}`);
}