NodeJs - Debugging Your NodeJS Application


NodeJs Debugging

Js debugging can be launched without any configuration when you're running a Node. js application on your local system. Open the starting file (typically index. js ), activate the Run and Debug pane, and click the Run and Debug Node.

You can use the node-inspector. Run this command to install it via npm:

> npm install -g node-inspector

Then you can debug your application using.

> node-debug app.js

The Github repository can be found here: https://github.com/node-inspector/node-inspector

Debugging natively

You can also debug node.js natively by starting it like this:

> node debug your-script.js

To breakpoint your debugger exactly in a code line you want, use this:

debugger;

For more information see here.

In node.js 8 use the following command:

node --inspect-brk your-script.js

Then open about://inspect in a recent version of Google Chrome and select your Node script to get the debugging experience of Chrome's DevTools.

Comments