English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Precondition
Node.js 6.3+, this can be accessedNode.jsofficial website for download;
Chrome 55+. If your local chrome is still less than or equal to55, you can download it from here:Chrome Canary, has been tested and works.
Configuration
As of now, parallel debugging of JavaScript and Node.js on the browser side is still a new feature and a new experience. In order to use it normally, you need to make the following configurations:
1Enter URL: chrome://flags/#enable-devtools-experiments. Note:If you use the Chinese version of Chrome, the name of the configuration item should be: Developer Tools Experimental Features, as shown in the figure below;
2、Enable it;
3、Restart Chrome;
4、Open DevTools Settings; -> Experiments tab;
5、Find Node debugging and check it.
Finally, you should be able to see something similar to the following figure, indicating that the environment is ready:
Debugging
Debugging is simple, just like a normal js file, use DevTools for breakpoint debugging.
Run Node.js app
You need to run Node.js applications in debug mode, which is very simple, just add the –inspect parameter.
node --inspect server.js
Note:server.js is my own application file, customized, and 'node.js' is shown in the figure below. If everything goes well, you should be able to see information similar to the following figure:
After running, you can see in DevTools -> Sources have server.js application:
After expanding, you can view the current js file of the node application, and now you can use Chrome for parallel debugging operations.
Finally
This new version of Chrome also has many other features, such as modifying file content during debugging and saving file snapshots.
Special thanks to the original author Serg Hospodarets for sharing. That's all for this article. I hope the content of this article can bring some help to everyone's learning or work. If you have any questions, please leave a message for communication.
Declaration: The content of this article is from the Internet, owned by the original author, contributed and uploaded by Internet users spontaneously. This website does not own the copyright, has not been manually edited, and does not assume relevant legal liability. If you find any content suspected of copyright infringement, please send an email to: notice#w3Please report via email to codebox.com (replace # with @) and provide relevant evidence. Once verified, this site will immediately delete the infringing content.