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".

 

Thanks.

14 comments
Comment actions Permalink

Must be https://youtrack.jetbrains.com/issue/WEB-35836. 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?

5
Comment actions Permalink

(Sorry for delay - was on vacation)

Thanks @Elena - that does indeed cure my problem!

:-D

2
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

Please see my comment above

1
Comment actions Permalink

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.

0
Comment actions Permalink

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

1
Comment actions Permalink

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. 

0
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

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.

0
Comment actions Permalink

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

0

Please sign in to leave a comment.