Archive

Monthly Archives: December 2013

I’m currently having a lot of fun experimenting with node.js using IntelliJ IDEA. I installed the node.js plugin, and although this added options to create a new ‘Boilerplate’ or ‘Express’ project, the rest of the node.js integration wasn’t quite so obvious…

In particular after creating a blank project and adding a few js files I noticed that several of the core node.js modules, such as ‘require’ were not being recognised by the IDE. I restarted the IDE and it did detect that I was coding using node.js, but it still didn’t detect these code modules e.g. “Unresolved function or method require” or “Unresolved function or method http”

It turns out that the IDE JavaScript libraries have to be configured properly. This can be done as follows (I’m using OSX, and so some of the menu names may be slightly different if you’re coding on Linux and Windows)

IntelliJ IDEA -> Preferences -> JavaScript -> Libraries 
-> [Ensure 'Node.js Globals' is checked]

This sorted the problem for me!

If you are interested you can follow my current experiment with node.js (using the excellent ‘Node.js In Action‘) in the following GitHub repo: https://github.com/daniel-bryant-uk/node-chat-experiment