Using node-inspector to debug node.js applications including on Windows (and using ryppi for modules)

Update: You can now use npm to install node-inspector and do not need npm is included as part of the node installation at I’ve updated the post to use npm.

The last few weeks I’ve been diving into node.js (more on why I am doing that in a very near future post Winking smile). If you don’t know what it is well, it lets you build server side applications using javascript. If you want a more detailed answer, check here.

One question I’ve been asking myself is how can I debug my node.js application? One option is to use Cloud9 IDE. Cloud9 offers a really cool IDE which runs in your browser as an HTML/Javascript application. It offers server-side debugging. You can run Cloud9 locally, but I ran into some issues doing it. What I was hoping for was a lightweight tool that I could just open locally to debug.

Yesterday I came across node-inspector while reading the “Hands on node.js” ebook. Node-inspector is a nifty node module by Danny Coates that introduces a visual debugger for stepping through your node apps. Yes modules are much more than just libraries folks!

Here are some of the cool features it offers.

  • Breakpoints
  • Step through
  • Evaluations including accessing server-side objects like console
  • Edit & Continue – You can change code on the fly and continue executing.

Installing on a Mac

I installed it on my Mac book pro without a hitch through using npm, the node package manager. You can follow the directions here. Once it is installed you can launch node-inspector using code similar to the following.

Next you open your browser to “http://localhost:8080” and voila you are in the debugger!

Here’s a screenshot of how it looks. In this case I am messing with evaluating a few expressions on the fly.



Installing on Windows

I sent an email to a bunch of folks talking about how cool node-inspector was. I then got back a reasonable question, “Does it work on Windows?”.

Short answer, “no”, that is not out of the box. However, with a slight change you can make it work. There’s a bunch of steps however to get to the point where you can even make that fix Smile. Read on…..

Before you get started, you will need to use either Google Chrome or Safari as your browser as node-inspector depends on webkit.

The first problem you hit into though is how to get all the packages in the first place. Fortunately npm has now been ported to Windows. If you install node from , npm is included. Once I had npm, “npm install node-inspector” is all I needed to get going.

Once I got the packages installed I then found node-inspector didn’t appear to be working. When accessing the debugger via the browser, my browser returned an HTTP Status Code of 403.  Searching around the internet I came across this comment which shows how you how to patch the “paperboy” module to make it work. Once I did that I was happy to see when I launched node-inspector plus node it worked.

Below are the steps to take you from 0 (node not on the machine) to node-inspector working. Install time, about 15 mins.

  1. Install node here.
  2. Create a root folder your source project will live i.e. “c:\code”. Your modules will live here as well.
  3. Open a new command prompt and go to the code folder you just created.
  4. Use this command to get node-inspector, “npm install node-inspector”. You will notice a bunch of modules are downloaded.
  5. After the download is complete you should see a “node_modules” folder in your code folder.
  6. Now comes the patch. In your modules folder you will see a module called “paperboy”. Go into that folder and edit the lib\paperboy.js file.
  7. Replace the filepath function with the code you see below.

Now we’re all set to use the debugger.

  1. Launch node-inspector “node_modules/.bin/inspector &”.
  2. Open a new command window.
  3. Change to the folder where your node project that you want to debug lives.
  4. Launch node with the following command “node –debug-brk app.js” (substitute app.js for whatever js you want to use)
  5. Open up your browser (Chrome or Safari) to http://localhost:8080.

If you followed all the steps I described you should see the debugger and be ready to go!


A bunch of work today, but it will get better.

The steps above to get node-inspector working are really a point-in-time issue. First, npm for Windows is in progress. Second, a patch has been submitted to paperboy to fix this problem.

Still and all though it took me a few hours to get there, it will take you 15 minutes now by following the directions (assuming you already have git installed Smile).

Have fun!

This entry was posted in node.js, Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Glenn Block

    I “think’ Danny Coates fixed it after we exchanged mails. He sent me code to try it out and I never got around to it. :-(

    Will try it out though, thanks!

  • armyofda12mnkeys

    node.js  has a Windows download now…
    I installed then installed node-inspector via npm (in my global node modules directory which i had to add to my PATH).
    I ran in one command window:
    node –debug index.js
    and in another:
    node-inspector &

    Started up in Chrome and seems to be loading.
    Can someone else confirm don’t need any special steps anymore?

  •ão-Rodrigues-Acabado/1183845507 João Rodrigues Acabado

    Typo: it’s “node ––debug-brk app.js” attention to the extra hyphen. According to my stubborn system and the elucidating doc in 

    Thanks for the great how-to!!

  • Testhaus

    Awesome on windows!!

  • Hadi Hariri

    Glenn have you tried WebStorm? That not only supports node but also provide debugging and runs on all platforms…