From the course: Node.js: Debugging and Performance Tuning
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Debugging Node in Chrome DevTools
From the course: Node.js: Debugging and Performance Tuning
Debugging Node in Chrome DevTools
- [Instructor] Another client that works with nodes inspector agent is Chrome Developer Tools built-in inspector. The steps for using Chrome DevTools are very similar to node inspect. First, make sure that you stop web in PM2. Then we'll try two different techniques. The first is to start web with the flag inspect-brk, which pauses execution on the very first line. The second is just inspect without pausing execution. Let's jump right in and switch to VSCode. Open up the terminal, and then we'll turn off the web server. Type pm2 stop web. The web status is now stopped. We're ready to start the web server with the inspector agent, to type node space --inspect-brk to break on the first line, and then the path of the script, servers/web/index, and press return. The debugger is listening but nobody's attached. Let's change that. Open up Chrome. We're gonna navigate to a special page. Type chrome://inspect and press return. Under remote target, you should see an entry that matches the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.