Over a million developers have joined DZone.

Issues when coding node.js using IntelliJ IDEA “Unresolved function or method”

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

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

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

java,devops,intellij,tips and tricks

Published at DZone with permission of Daniel Bryant, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}