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
- Found in ToolBar
Run And Debug
Button and click, or directly<Command+Shift+D>
Open the debug - Top test selection in debug panel
Run Current File
- 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?
<Control + ~>
Open the Terminal- in
Terminal
Click on the right of panel+
“Small button and continue to clickJavascript Debug Terminal
, open the JS debugging terminal - 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