This section describes how to debug node using chrome.

Installing a plug-in

The Node-Inspector installation is required for Chrome debugging

npm install -g node-inspector
Copy the code

Start debug Listening

 node-inspector
Copy the code

Debug listening occupies port 8080 by default

node-inspector --web-port 9999
Copy the code

Start the Node program

 node --debug app.js
Copy the code

The above method does not stop at the first line of the program. To stop at the first line of the program, you can start it in the following way

 node --debug-brk=3333 gulp.js
Copy the code

Chrome debugging

Open the following link in your Chrome browser:

 http://127.0.0.1:8080/?port=3333
Copy the code