Webinar Recording: Node.js Development Workflow
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.
Q: How to enable autocompletion for 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?
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.
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