Node.js debugging with VS Code

Learn how you can debug the code using VS editor.

We'll cover the following

📢 The contents discussed in this lesson will help you in debugging with Visual Studio on your machine.

Debugging with VS Code

The free Visual Studio Code editor has built-in Node.js debugging facilities as well as debugger extensions for all popular platforms.

📌 VS Code also has extensions to help with Docker management and file syntaxes, as well as remote development to open directories inside containers. These are not used or required here because the debugger running in your container permits remote access. However, they offer some interesting development options.

Ensure your application is running in development mode, then launch VS Code, open the project’s root directory, and load index.js. A breakpoint can be added by clicking to the left of any line e.g., a breakpoint on line 19 has been added in the image below:

Get hands-on with 1200+ tech skills courses.