Haspemulator Haspemulator - 3 months ago 42
Node.js Question

How to import existing node.js module into Intellij IDEA?

I have an existing Node.js codebase, forked from GitHub. Now I want to import it to the Intellij IDEA 13 (ultimate version, which supports Node.js). When I simply try to import the project from the root folder of my existing code, IDEA doesn't add the 'lib' folder, where all the sources are. It should be simple, but I cannot figure it out. Any hints?


Well, I've figured out a workaround, but not sure if it's the best solution. One can just create a new project of type "Web", and point it to the directory containing the module's sources. Then IDEA understands the whole structure, and you can create run configurations with Node.js.

In order to get additional Node features, like Intellisense for standard Node APIs, you'll still want to configure the project to be a Node project:

  1. Open the Preferences window
  2. Click Languages & Frameworks → Node.js and NPM
  3. In the section Coding Assistance you'll see if Node.js Core library is [not] enabled. If it is enabled, there's nothing more to do. If not click the Enable button
  4. Leave For the whole project checked, and click Configure
  5. The text should now change to Node.js Core library is enabled.