Debug node.js remotely with your favourite browser

One of the best thing about node is that it can be debugged via the Remote Debugging Protocol. Here I would like to show a demo about how to setup a simple debuggable project.

Some requirements of this tutorial:

  • Unix-like system environment.
  • Some basic knowledge of node, npm and express.
  • Some basic knowledge of shell.

You just need to create two files to make it work. First of all create a folder, let’s call it “debug_demo”.

$ mkdir debug_demo

Then the “package.json” file:

The “package.json” file is most important part of this project. There’s a package called “node-inspector” in the dependency section. It will setup a debug server for us to help exchange information between the node project and browser.

At last create the main file “app.js”:

Then, we need to run some commands in the shell:

Finally open your browser and visit the port 8112 and 8080, you can change the default port if it is already in use. To you it may be “” and ““. The result should like below:

node remote debug demo


Very simple, isn’t it?