How to stop NodeJS require() being flagged as "unresolved"

I've recently done the WS upgrade to 2018.3 - unfortunately somehow during the course of that some setting's got messed up. So now when I load my NodeJS JS code I'm getting the in-built code inspector, (note, not ESLint, JSHint, etc), complaining that "Unresolved function or method require()".  I've checked online and all the articles say to make sure that "Node.js Core" is enabled in Preferences->Languages & Frameworks->JavaScript->Libraries. I've checked and it is.

So is there some other step I need to do to make sure that WS recognises require() as being known (because it's part of NodeJS). It's also complaining about "module" too as being an "Unresolved variable or type module".




Must be Please disable Node.js coding assistance in Preferences | Languages & Frameworks | Node.js and NPM, apply and then re-enable it to get libraries downloaded - does it help?


(Sorry for delay - was on vacation)

Thanks @Elena - that does indeed cure my problem!



I have this same problem - applying the settings described by @Elena doesn't work for me.  Running WebStorm 2018.3.2.


Confirming that this issue exists in Webstorm 2018.3.3. Steps disable/enable Node.js coding assistance do not work for me.


Can JetBrains just reproduce it?  Looks like it's happening for everyone.  I can't supply any files since it's against my company's policy.


If we could reproduce it, I won't ask you for steps, logs, etc. And no, it doesn't happen to everyone, it works for almost all users


I also had this problem on Ubuntu. I had installed Node using apt install node and require was being recognized. Then I installed/updated Node using the npm package 'n', after which require stopped being recognized. I tried the steps above and they didn't work for me, even though I had the new Node installed by 'n' selected. 'require' started being recognized again after I removed the Node installed with n.


Also worth noting maybe? I'm using Rubymine (not Webstorm)

Maybe this will help someone. 


I have the same problem with a fresh installation of webstorm! 


Please make sure to enable Node.js coding assistance in Preferences | Languages & Frameworks | Node.js and NPM; if it doesn't help, try invalidating csches


The same thing. Everything is enabled, but codding assistance just doesn't work in WS. Doesn't matter for which project. Was forced to open it in PhpStorm. Here everything works fine.


This feature works exactly the same in WS and PhpStorm (same plugins involved). Something must be broken in your WS configuration/installation


Please sign in to leave a comment.