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 with Visual Studio Code
From the course: Node.js: Debugging and Performance Tuning
Debugging Node with Visual Studio Code
- [Instructor] We've seen both Node Inspect and Chrome DevTools, so how does VS Code's built-in Node debugging support size up? We're gonna have to do a little bit more work to get Visual Studio Code debugging. Again, make sure that you stop web in PM2 if you haven't already. Then, we'll need to edit the launch configuration so VS Code knows where it should be starting and where to log. Finally, we'll use VS Code to start Node in debugging mode and control execution. Let's get started. Switch over to VS Code. The first thing we're gonna want to do is to stop web in PM2, so open up the terminal, type pm2 stop web. The process is now stopped. Close the terminal again. Navigate up to the debug menu, and select open configurations. We'll be prompted for an environment. Select Node.js. This generates a new file in the .vscode folder named launch.json. If we look at the program path, it just says workspaceFolder/index.js. That's fine, except our server is somewhere else. Let's edit 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.