Debugging or finding problems in code is one of the most important work for a developer. Every programming platform provides debugging tools for developers to work with.
Node.js also provide debugging tool that allow us to debug our Node.Js code in chrome browser.
Let us quickly check out how we can do this:
- Make sure you have Node.js version 6.3 or better
- If you have entry file named app.js, then execute the following line to start debugging:
node --inspect app.js
- The above command will start debugger and print a link something like this:
- Copy the above link in chrome web browser and you are ready to go.
- Click on the source tab and you will see all your source code.
Click on any file to open the source code.
Click on any line number to set break-point.
That’s it, have fun with debugging.