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:

  1. Make sure you have Node.js version 6.3 or better
  2. If you have entry file named app.js, then execute the following line to start debugging:
    node --inspect app.js
  3. The above command will start debugger and print a link something like this:
     chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/8ab8642c-c1ca-4be9-b979-957894855a8d
  4. Copy the above link in chrome web browser and you are ready to go.
  5. 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.