Tips & Tricks

Running and Debugging Node.js Application

Check out a newer blog post on debugging Node.js apps.

Let’s continue our series of posts and tutorials on Node.js development in WebStorm.

Our first post covered the basic WebStorm configuration for working with Node.js projects. Now let’s move on to running and debugging Node.js apps both locally and remotely.

Running Node.js app locally

WebStorm allows you to run Node.js application locally on your machine: you should create a Node.js Run/Debug configuration for the file you need to execute and click Run.

To create a new Run/Debug configuration, click Edit configurations in the top right corner of the IDE window, or in the main menu Run.


Click Add new configuration and seleсt Node.js type.

In this new Run/Debug configuration, specify the path to the JavaScript file that needs to be executed. For example, for a simple Express web app it should be a file that configures and starts the web server.


You can also add any parameters you need to pass to node (Node parameters input) or to your application (Application parameters input) on the start.

Update: Starting with Express 4.0 file www in bin folder needs to be executed to start the app. When creating a new Express web application in WebStorm, the required Run/Debug configuration will be created automatically.

Select this new configuration and click Run. The Run tool window with console will appear showing the app execution log.


Debugging Node.js app locally

The same configuration can be used to debug your Node.js code. The built-in Node.js debugger allows you to step through the breakpoints, change values on the fly, evaluate expressions, and set watches.

Click the Debug button for the created Run/Debug configuration in the top right-hand corner of the IDE, from the Run menu or with the shortcut
(Shift+F9 on Windows or Linux, Ctrl+D on Mac). A tool window with variables view, frames and watchers for your debug session will appear:


Debugging Node.js app that runs remotely

With Remote Node.js Debug configuration you can debug Node.js apps that are running remotely. You’ll be able to restart the debug session without restarting the app itself.

Select Remote Node.js Debug type when creating a new debug configuration, then specify the host you need to connect to and the port.


Now that the debug configuration is ready, select it from the drop-down list of configurations on the right and click Debug.

You’ll see the Debug tool window when the breakpoint is reached. You’ll be able to use full-featured debugger in the same way as if you were debugging your code locally.

Please note that for remote debug your app should be running with --debug= or --debug-brk= parameter.

Have a look at the previous post on Node.js development in our blog: “Getting started with Node.js in WebStorm”.

Develop with pleasure!
-JetBrains WebStorm Team

Comments below can no longer be edited.

28 Responses to Running and Debugging Node.js Application

  1. Avatar

    Chris says:

    February 22, 2014

    It would be nice to cover simultaneously debugging javascript in the browser when running a Node.js app.

    It took me a while to discover I had to edit the JavaScript Debug target’s “Remote URLs of local files” and specify the full URL of the static javascript directory, to get WS7 to honor breakpoints when connected to Firefox.

    • Ekaterina Prigara

      Ekaterina Prigara says:

      February 23, 2014

      Will cover it soon, thanks for idea. Should be helpful for other users.

  2. Avatar

    angel says:

    March 20, 2014

    sorry, I follow the steps but I can’t find than the debug stop in my breakpoint, I set the breakpoints, then configure the debugger to point my file and directory, run it and in the console shows than a port is open…what is the next step??…there is some tutorial or video showing how debug??…thanks!

  3. Avatar

    Eric Swann says:

    June 12, 2014

    This demo may no longer be accurate. On windows (x64), I followed the directions and simply got: “Process finished with exit code 0”. No server startup.
    However, the template also comes with a default configuration “bin\www” which did work. It seems that instead of selecting “app.js” for the javascript file to run, you must specify “bin\www” when setting up the config. The demo also doesn’t specify how to set up the default port, which I had to manually add in the app.js: app.set(‘port’, process.env.port || 3000). I see it in the animated image, but there’s no explanation and it’s actually after the lines that state to run the project.

    • Ekaterina Prigara

      Ekaterina Prigara says:

      June 12, 2014

      bin/www configuration was added just recently with WebStorm 8 bug fix update after Express 4 release where the seed project structure was changed. I would update the tutorial.

      • Avatar

        Eric Swann says:

        June 13, 2014

        Cool thanks for the explanation!

      • Avatar

        Maheshwari says:

        September 8, 2014

        I have downloaded evaluation version. And I also get the same “Process finished with exit code 0” error. I tried to set http://www.js but I am not able to find any such file or setting. Can you please elaborate on this. Probably add the gif file for this update, same as node-rdc.gif?


        • Ekaterina Prigara

          Ekaterina Prigara says:

          September 8, 2014

          Hello Maheshwari,
          You’ve created a new Express project with Create new project dialog, right? Then you should have a predefined run/debug configuration called www/bin that starts the app.

  4. Avatar

    Lola says:

    September 11, 2014

    I have a problem in WebStorm’s debug Tool with the variables panel. When i am debugging a Node application the “Set value” option is inactive.
    What is the problem?


  5. Avatar

    Bryan Rayner says:

    October 4, 2014

    This is great – I’m really looking for help in understanding why some parts of the execution flow can’t be stepped into, or stepped over? It seems to be a problem with how I’ve configured WebStorm, but it’s configured exactly as this blog post describes. How do you get the step into / step over to work properly on a Node.js app?

    • Ekaterina Prigara

      Ekaterina Prigara says:

      October 6, 2014

      You mean you get different behaviour when stepping in/over from the video?

      • Avatar

        Ivan Zhukov says:

        October 24, 2014

        He means that when evaluating stops on a breakpoint, pushing Step Over, Step Into doesn’t continue debugging, it just resuming script execution… The same happens for me in WebStorm 8.0.4 and Node v0.10.32.
        Is that even possible to step over/in when debug server JS?

        • Avatar

          Ivan Zhukov says:

          October 24, 2014

          Hah, done!
          Jump to the IDE Settings > Debugger > Javascript
          Uncheck “Do not step into library scripts” and “Do not step in to scripts”

          • Avatar

            Anand says:

            June 2, 2015

            You made my day 🙂
            Thanks for this…

          • Avatar

            Denis Sokol says:

            June 2, 2017

            Spasibo 😉

  6. Avatar

    H Lock says:

    April 25, 2015

    I am debugging in WS 10.0.2 on node.js while developping with http server (under the hood of jayData odata-server).
    I run the server (with breakpoints set in a data provider) in debug mode under WS and the send a request (via Browser or nodejs http.request doesn’t matter).
    WS reaches the breakpoint, shortly pauses and then aborts.
    Console output:
    Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)

    Could somebody please help me?

    • Ekaterina Prigara

      Ekaterina Prigara says:

      April 27, 2015

      Does it work in “Run” mode (not debug)?
      What Node.js version do you use?

      • Avatar

        meghraj choudhary says:

        November 6, 2016

        Yes, works well in normal run, but not in debug mode.
        i am using typescript (ts-node)

        • Ekaterina Prigara

          Ekaterina Prigara says:

          November 7, 2016

          What WebStorm version do you use? Can you please provide a bit more details on your project configuration here or in a new issue on our tracker: Thank you!

    • Avatar

      Maxim Boltenkov says:

      April 27, 2015

      Try to clear your ‘Watches’! For me it’s work.

      • Avatar

        xiahaoyun says:

        August 5, 2017

        work for me,too.

  7. Avatar

    Maxim Boltenkov says:

    April 27, 2015

    Try to clear your ‘Watches’! For me it’s work.

  8. Avatar

    mangesh says:

    May 6, 2015

    Thanks for demo…work for me very well …follow steps open browser and type url localhost:3000 ..showing me Express Welcome to Express..Thank you so much..Thanks

  9. Avatar

    susnick says:

    August 28, 2015

    This does not work for me. I can run the configuration just fine, but debug the configuration does not work. From what i can see is that Run calls “node.exe bin\www.js”, while Debug thinks its debugging remotely i guess. It runs “node.exe –debug-brk=62506 –nolazy bin\www.js”. I have not been able to locate where these parameters are being set to remove them. Can you help?

    • Ekaterina Prigara

      Ekaterina Prigara says:

      August 31, 2015

      All seems correct. That’s a proper parameters for debug configuration, not a remote one. Why do you think that debug doesn’t work? Can you run your app from WebStorm? Does it stop on breakpoints when you start a debug session?

  10. Avatar

    Nez07 says:

    June 7, 2016

    Where should I define the command line parameters that my protractor conf.js requires like –params.username=”username” etc. while setting up the configurations. Could you please provide the format also for the same.
    I tried putting the command line parameters in Node parameters but it gives me error running.

    • Ekaterina Prigara

      Ekaterina Prigara says:

      June 7, 2016

      Please try the following Node.js run configuration:
      JS file: node_modules/protractor/built/cli.js
      Application parameters: protractor.conf.js [and your options here]
      Or the other way around: your options first and then the congif file.