Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of debugging Node.js in VSCode

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "the method of debugging Node.js in VSCode". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the method of debugging Node.js in VSCode".

The simplest way to debug: Run Current File

Because of VSCode's built-in Node debugger, debugging Node is extremely simple and follow these steps. [recommended: "vscode tutorial"]

Find the Run And Debug button in ToolBar and click, or open debugging directly

Select Run Current File in the debug panel top test

Click the green debugging button to start debugging

Run Current File is just a click to debug NodeJS, so how do you debug Typescript and more complex large projects?

Debugging project: JavaScript Debug Terminal

What if there is a ts file that needs to be debugged?

Open Terminal

Click the + button on the right side of the Terminal panel, and continue to click Javascript Debug Terminal to open the JS debuggable terminal

Enter the command to execute the ts file: npx ts-node index.ts

If starting the project is particularly complex, how to deal with it?

The following example (though not particularly complex) abstracts the startup command as npm start.

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

The second step is to enter the command npm start in the debug terminal

Step 3, start debugging

At this point, I believe you have a deeper understanding of "the method of debugging Node.js in VSCode". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report