How debug Node.js applications using Eclipse


In this post I’ll help understand how can debugging a Node.js application from scrach.


You need installed in you computer the following tolls:

  • Java
  • Eclipse
  • Node.js (make sure that you have access a node command in your command line tool)

Create a Simple Node.JS application

First, we’ll install express.

npm install -g express

Note: The -g flag means that you are installing express globally on your system.

So, now we are available for create a node.js application using express.

express -c stylus express-app-sample

Note: The -c states that we want to use stylus for css.

The next step, is install the app dependencies. So, we need enter express-app-sample folder and install. We can do that with the following commands:

cd express-app-sample
npm install

And now we’re available for running our app. What we need to do is the following command.

node app.js

You should see Express server listening on port 3000 and if you open http://localhost:3000 you’ll see the default Express page.

Debugging Node.js application using Eclipse

Install Eclipse debugger plugin for V8

With Eclipse debugger plugin for V8 we can easy used for debugging node applications. This is the steps to install the plugin on Eclipse:

  1. Select the menu item Help > Install New Software…
  2. Click on Add… button.
  3. In the textbox labeled Name: enter Google Chrome Developer Tools. In the textbox labeled Location: enter Click OK.
  4. Select Google Chrome Developer Tools from the combo box Work with.
  5. Click the checkbox next to Google Chrome Developer Tools in the table. And Click the button labeled Next >.
  6. Accept the terms of the license agreement and click the button labeled Finish.
  7. Eclipse will restart with the V8 Eclipse Debugging Plugin installed.

Debug node.js application

  1. Using node.js command line, we’ll launch our app on debug mode, using the following command:
    node --debug=5858 app.js
  2. In the Menu, choose Window > Open Perspective > Other, then select Debug from the list and click OK, to ensure we are viewing the debug perspective.
  3. Click the drop box button next to the green bug one and select “Debug Configurations …” option.
  4. Start the debugging by clicking “Debug” button. If everything goes well, we’ll get something like this:
  5. So, we just need to put breakpoints on the project that appears when we start debugging, in the Project Explorer, to debug.

NOTE: You can find out more about debugging node.js applications using Eclipse in this link.

Tagged , , ,

One thought on “How debug Node.js applications using Eclipse

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: