Node.js remote debug in WebStorm

Node.js remote debug is the perfect option for the cases, when you project is run inside the Vagrant box.
Luckly, both node.js and WebStorm have all the needed options, to make the debug still possible and convenient.

Below it’s described how to configure the Node.js Remote Debug in WebStorm.

My WebStorm version is 11, node.js version is 4.2.2.

Let’s assume, that my Vagrant box configured to be in private network with my machine, and it exposes all the ports to the IP

node.js remote debug with WebStorm example

  1. Our node.js app is a simple hapijs server.

  2. Being inside the Vagrant server we should run the app with the next command:

    In the console we will see the next:

    node.js remote debug with WebStorm
    As well, the app works through the browser:
    node.js remote debug with WebStorm

  3. Next, let’s configure the WebStorm part. We should create new run/debug configuration for our project.
    In case of remote debug, it’s not possible to run the application, it’s possible only to debug.
    node.js remote debug with WebStorm
    Click “Apply” and that’s it.
  4. Now, we are able to set the breakpoint and connect our debugger.
    node.js remote debug with WebStorm
  5. Now, let’s try to open the next url in the browser: .
    If everything is setup correctly, you will be brought back to the WebStorm right to the middle of the debug session:node.js remote debug with WebStorm
  6. Cool, you don’t need to spoil your private PC with all kinds of software needed to run your application, but you still can debug it in the convenient way. As you understand – configuring the remote debug for any other server where you run your node application would be the same. You can debug your AWS or digitalocean node applications as well, just be sure, that the debug port is accessible from the PC where you run the WebStorm.