How to Debug Node.js Program with VS Code?

Debugging has a lot to introduce in Node.js direction and web direction, so I decided to divide this series of articles into the following:

For complex open source projects, using debugging can quickly understand the role of the code and the author’s intention, help you understand its internal principles, make you continue to advance in programming, and finally become a senior front-end developer and get a higher salary.

If you also want to become a Senior Front-end developer, mastering debugging is a key skill. It will help you understand how the program works and gradually improve your coding level.

Quick Start

VS Code Debugging Gif

Launch Configurations

{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${file}"
}
]
}

Breakpoint Options

Debugging App

VS Code Debugging Screenshot

Left Panel

Left Panel Screenshot

Debug Actions

Debug Actions Screenshot

Debug Console REPL

Debug Console REPL Screenshot