Home >Web Front-end >JS Tutorial >What debugging tools do you use for nodejs?

What debugging tools do you use for nodejs?

青灯夜游
青灯夜游Original
2021-11-05 17:33:331860browse

Tools for debugging node: 1. "What debugging tools do you use for nodejs?", supports advanced features such as "long/async" stack tracing, and can be seamlessly integrated with Chrome; 2. Node Inspector, provides a visual debugging interface based on Chrome ;3. Visual Studio Code.

What debugging tools do you use for nodejs?

The operating environment of this tutorial: windows7 system, nodejs version 12.19.0, DELL G3 computer.

Three tools for quickly debugging nodejs

1. Built-in What debugging tools do you use for nodejs?

This It is a debugging tool developed by the official team. It supports advanced features such as long/async stack tracing and can be seamlessly integrated with Chrome. The startup steps are as follows:

1. Execute the What debugging tools do you use for nodejs? command to start debugging;

2. Open Chrome and enter chrome://inspect in the address bar;

3. Select the JS that needs to be debugged;

The example is as follows, please refer to the detailed usage See the official description:

#  首先安装What debugging tools do you use for nodejs?
npm install --global What debugging tools do you use for nodejs?
# 启动调试监测
What debugging tools do you use for nodejs? App.js
# 也可以调试远程JS,如
# What debugging tools do you use for nodejs? <host>:<port>

Disadvantages:

1. Slow;

2. Very slow;

3. What’s even worse is What debugging tools do you use for nodejs? Open it as a pop-up window, and macOS happens to not allow pop-up windows, so the result is very tragic and completely unusable;

What debugging tools do you use for nodejs?

2. Node Inspector Chrome

Node Inspector is a very early debugging tool. It provides a visual debugging interface based on Chrome. It is simple to operate and easy to get started, as follows:

#   安装调试器
npm install -g What debugging tools do you use for nodejs?or
#   监听调试服务
What debugging tools do you use for nodejs?or -p 8000
#   启动调试程序
node --debug-brk App.js

Finally open http ://localhost:8000 can be used for debugging. The screenshot is as follows:

Node Inspector

3. Visual Studio Code

This is the biggest dark horse. At first glance, I thought it was Microsoft's flagship product, but the style is really similar. It is simple, efficient, and powerful. The debugging is directly built into the IDE, and you can start it directly without any explanation. , people will meet each other, download it quickly and use it, see the picture below.

Visual Studio Code

[Recommended study: "nodejs tutorial"]

The above is the detailed content of What debugging tools do you use for nodejs?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn