Webstorm 7 cannot recognize node API methods
Solution 1
For WebStorm 7 thru 10 (on OSX)…
WebStorm → Preferences → Languages & Frameworks → Javascript → Libraries
Select "Node.js Globals" and "Node.js vXXX Core Modules".
Solution 2
For 2018 and later versions of WebStorm:
In Settings -> Languages & Frameworks -> Node.js and NPM, check Coding assistance for Node.js:
In older Webstorm versions, this was called Enable Node.js Core library.
If you still see unrecognized Node symbols even with that option enabled, unckeck it, restart WebStorm, then right click on the warning and choose Enable Node.js coding assistance or just check the option again. Watch for WebStorm to show it's Indexing files. (Just had this happen today - looks like a WebStorm bug, and what I just wrote fixed the situation.)
Solution 3
As I've answered on the WebStorm says console is an unresolved variable question, to solve these problems on the new Webstorm versions, you need to enable the Coding assistance for Node.js.
To do this, go on the Settings
> Languages & Frameworks
> Node.js and NPM
and click on the Coding assistance for Node.js
option, and then click OK to save:
This will all Node.js unresolved variables and functions.
Update
On the new Webstorm versions, just going above error and clicking in More Actions...
(or ALT+ENTER) and selecting
Enable Node.js coding assistance will solve this.
hba
Updated on June 27, 2022Comments
-
hba almost 2 years
I just installed WebStorm. I'm working on a small Node.js app.
I've attached the Node.js source code, and when I click on the Node.js settings, I can see that it can recognize my various node modules, etc.
I'm having two issues:
- Unresolved variable or type: WebStorm doesn't seem to recognize simple API methods (
exports
,require
). - No code insight for…: If I call
require('winston')
, it tells me that it has no code insight. (Is there a way I can add the source code?)
- Unresolved variable or type: WebStorm doesn't seem to recognize simple API methods (
-
Dave Teply about 9 yearsWorks for WebStorm 10.0.1 (on Windows 7) as well. Thanks!
-
HamasN over 8 yearsWorks for me. WebStorm 10.0.3(Mac). Many Thanks.
-
Dan Dascalescu over 7 yearsHey Ted, can you have a look at the comment under my answer? Thanks.
-
Ted Bigham over 7 years@DanDascalescu What am I looking for Dan?
-
Ted Bigham over 7 yearsThe question is actually about WebStorm 7. None of the answers claim to cover that, although after some googling I believe the accepted answer (mine) works with WS7 too.
-
Kurkula about 7 yearsfile -> default settings -> languages & frameworks -> nodejs and npm -> coding assistance -> Enable
-
Ted Bigham almost 7 years@DanDascalescu The question was about WebStorm 7
-
Tom over 5 yearsFor me, now, the library required was simply "node" in the same spot that @TedBigham mentioned.