Node.js applications can be debugged in 3 different approaches in VSCode. JavaScript Debug terminal is one easy approach among them.
-
Go to menu
View -> Terminal -
This will open a integrated terminal. Select the
JavaScript Debug Terminalfrom the terminal switcher dropdown. -
You can debug Node.js applications directly by using the command
npm startornode <starting JS file-name>
-
Double clicking in in the gutter beside a line number will include a breakpoint which will pause the execution while hitting the line.
-
Alternatively , right-click in the gutter beside a line number and select " Breakpoint"
-
Right-click in the gutter beside a line number and select "Conditional Breakpoint"
-
Create expression for the breakpoints that only pause when the defined expression returns a truthy value.
-
Right-click in the gutter beside a line number and select "Log Breakpoint"
-
Create logs that can be be printed while crossing this breakpoint.To print variable, place them inside
{variable-name}curly braces.








