Webinar Recording: Node.js Development Workflow

The recording of our February 20th webinar with Adron Hall, Node.js Development Workflow, is now available on JetBrains YouTube Channel.

In this webinar you will learn the basics for working with Node.js web projects in WebStorm. Adron shows how you can run and debug a Node.js app and test it with Mocha.

We received quite a few questions during the webinar and would like to address here the most frequently asked questions and those we didn’t have a chance to answer during the webinar.

Q: How to enable Node.js support in PhpStorm (PyCharm, IntelliJ IDEA, RubyMine)?
A: Make sure that Node.js plugin is installed (Settings | Plugins).

Q:How to enable autocompletion for Express?
A: Express framework is implemented in a very dynamic way, making it difficult for WebStorm to provide accurate code completion for methods from Express module by just parsing the source code.

We recommend downloading the relevant TypeScript definition file: Settings | JavaScript | Libraries – Download – TypeScript Community Stubs – Express.


Q: How to enable autocompletion for Mocha?
A: The same applies for Mocha: go to Settings | JavaScript | Libraries – Download – TypeScript Community Stubs – Mocha.

In a screencast on using Mocha, where you can learn how to do it.

Q: Can I exclude the node_modules directory from the project index?
What is the difference between Excluded option and adding a custom library in Settings | JavaScript | Libraries?
A: You can do that, but it’s not recommended. Better create a Node.js Dependencies JavaScript library instead.

Here is an explanation:

You can exclude any directory from the project by right-clicking it and selecting Exclude. In this case WebStorm will NOT index this folder, but as a result it won’t resolve methods from these libraries and won’t provide code completion. That’s why we don’t recommend doing it for node_modules folder.

Instead, create a Node.js Dependencies JavaScript library. Note that WebStorm will suggest doing that on the project start.

node_modules folder will be added to the list of JavaScript libraries used by WebStorm for code completion, syntax highlighting, navigation and documentation lookup. Code inspections will be disabled for these files, but they will still be in the project index.


Note that if you try to exclude node_modules folder that is already marked as library home (or any other folder that is already added to JavaScript libraries), this folder will still be indexed.

Q: Is it possible to debug a Node.js application that runs remotely? Is it possible to debug when your node and the rest of the dependencies (database, etc.) are running in a VM environment like Vagrant?
A: You should use a Node.js Remote Debug configuration to connect to the remote debug session. Please have a look at our recent tutorial on running and debugging Node.js applications.

Note that you need to run your app in debug mode and configure external access to the debugger on your server (or VM).

Q: Does the debugger support cluster mode?
A: Yes, just make sure you use Node.js v.0.11.x.

Q: How can I run only a single test (not the entire test directory)?
A: Unfortunately, right now WebStorm doesn’t support that. You can vote for this feature request in this YouTrack issue.

Q: What if I have a large project with multiple test directories?
A: Right now you cannot select multiple test directories in Mocha configuration in WebStorm. You have to create a separate configuration for each test directory.

If you have more questions about Node.js and Mocha, please feel free to ask in comments.

Develop with pleasure!
– JetBrains WebStorm Team

Adron HallAdron Hall goes by the title, “Coder, Messenger, Recon.” He is passionate about coding and loves seeing technologies built and technologies come together. Having vast experience with many different languages, Adron now focuses on building JavaScript apps. He uses every chance to share the knowledge he has gained over the years in workshops, one-on-one mentoring, pair programming or directed training. Adron’s personal blog is Compositecode.com.
Comments below can no longer be edited.

8 Responses to Webinar Recording: Node.js Development Workflow

  1. Avatar

    A. Lester Buck III says:

    March 13, 2014

    Q: Does the debugger support cluster mode?
    A: Yes, just make sure you use Node.js v.0.11.x.

    Since the latest Node.js version is 0.10.26, I don’t know what this means.

  2. Avatar

    Esfandiar says:

    March 14, 2014

    Hello, I know it’s possible to debug Node.js remotely with WebStorm, but is it possible to debug a Mocha test remotely as well? When I add a Mocha configuration (in Run/Debug Configuration) it expects the location for “Node interpreter”. But my Node is installed on the VM. Even if I install Node locally (on OS X), some of the node modules that are installed in the VM don’t seem to work under Mac (obviously if I do a npm install locally it would work but that wouldn’t be debugging the tests on a remote VM anymore). Is there a way around this? Thanks.

    • Ekaterina Prigara

      Ekaterina Prigara says:

      March 15, 2014

      There is no way you can run tests remotely with the default test run/debug configurations WebStorm provides. The only thing is that you can debug your tests (but don’t see results in the tree view, navigate, etc) if you start them on your own remotely and then connect to the remote host using Node.js Remote Debug configuration.

  3. Avatar

    Dave Schinkel says:

    June 1, 2015

    I’m running Webstorm 10.0.3. I noticed that if I don’t set something like –debug-brk=8080 as a node parameter in my debug config, it’ll run debug in a random generated port which conflicts with what’s set in my app.js port defined so for example if I have the port set to 3000 for express, when running Debug in webstorm I get:

    /usr/local/bin/node –debug-brk=51897 –nolazy app.js
    Debugger listening on port 51897

    so how were you able to to in your screen cast above leave that node param out, yet you still get yours always running on port 3000 when in in a debug session?

    • Ekaterina Prigara

      Ekaterina Prigara says:

      June 2, 2015

      This port number is the port that the Node.js debugger is running on (and WebStorm connects to). It has nothing to do with the port your app is running on. So there’s no need to set the debugging port manually, WebStorm takes care of it.

  4. Avatar

    Randy says:

    November 17, 2015

    Is it a joke that you developed a $129 editor that can’t autocomplete common libraries found in your node_modules dir out of the box? Do you not have any pride in the software you develop?