Stepan Yakovenko
Stepan Yakovenko

Reputation: 9216

Why does Intellij IDEA shows require undefined with nodejs?

Does anyone know why intellij IDEA underlines require? How can I fix this?

enter image description here enter image description here

Upvotes: 11

Views: 7252

Answers (3)

Matthew Woo
Matthew Woo

Reputation: 1377

I don't know why my version isn't quite the same (new version? Fresh install?) but my IntelliJ Ultimate didn't have the Node.js Core library @SergioFilhow mentioned.

I had to go to File > Settings > Languages & Frameworks > Node.js and NPM: "Coding assistance for Node.js". After I configured this for my projects, the Node.js Core library showed up under Languages & Frameworks > JavaScript > Libraries.

Upvotes: 6

Atilio Jobson
Atilio Jobson

Reputation: 469

I had the same problem on windows, with IntelliJ IDEA 15.0.3. The solution was:

File -> Settings -> Languages & Frameworks -> Nodejs and NPM: Click "Enable" button next to Node.js Core library, accept defaults.

Upvotes: 17

Sergio Marcelino
Sergio Marcelino

Reputation: 1146

Open preferences page and select Languages & Frameworks > Javascript > Libraries and select Node.js Globals, just like the image below.

No need to add Node.js core modules (I didn't add and worked the same way)

in this screen, select Node.js Globals

Upvotes: 16

Related Questions