Hello, I’m Shanyue.

Just get right to it.

The simplest way to debug: Run Current File

Debugging Node is extremely simple thanks to VSCode’s built-in Node debugger. Follow these steps

  1. Found in ToolBarRun And DebugButton and click, or directly<Command+Shift+D>Open the debug
  2. Top test selection in debug panelRun Current File
  3. Click the green debug button to start debugging

Run Current File is just a point to debug NodeJS, but how about debugging Typescript and larger, more complex projects?

Debugging project: JavaScript Debug Terminal

What should I do if I have a TS file to debug?

  1. <Control + ~>Open the Terminal
  2. inTerminalClick on the right of panel+“Small button and continue to clickJavascript Debug Terminal, open the JS debugging terminal
  3. Enter the command to execute the ts file:npx ts-node index.ts

What if starting the project is particularly complex?

As an example (although not particularly complex), the start command is abstracted as NPM start.

{
  "scripts": {
    "start": "NODE_ENV=production node index.js"}}Copy the code

Second, enter the command NPM start in the debugable terminal

Step three, start debugging