Work with the browser for debugging

You can check out the official Node documentation at nodejs.org/zh-cn/docs/…

  1. In vscode’s inheritance terminal, enternode --inspect-brkThe current file to be debugged

  1. Enter it in the Chrome address barchrome://inspect/#devicesAnd then click

open dedicate DevTools for Node

  1. Finally, you can debug js code running in the browser console

How to use vscode’s built-in tools for debugging?

  1. Click on the triangle shape symbol of vscode as shown, then click create a launch.json file

  1. This will automatically create a launch.json file in the current working directory. Vscode

Click on the small triangle symbol to debug

Note: It is important to note that if you want to debug the Node source code, you need to set theskipFilesThis property is commented out3. Finally, you can debug the code as shown