Webstorm 7 cannot recognize node API methods

10,615

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:

WebStorm setting to enable 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:

enter image description here

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.

enter image description here

Share:
10,615
hba
Author by

hba

Updated on June 27, 2022

Comments

  • hba
    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:

    1. Unresolved variable or type: WebStorm doesn't seem to recognize simple API methods (exports, require).
    2. 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?)
  • Dave Teply
    Dave Teply about 9 years
    Works for WebStorm 10.0.1 (on Windows 7) as well. Thanks!
  • HamasN
    HamasN over 8 years
    Works for me. WebStorm 10.0.3(Mac). Many Thanks.
  • Dan Dascalescu
    Dan Dascalescu over 7 years
    Hey Ted, can you have a look at the comment under my answer? Thanks.
  • Ted Bigham
    Ted Bigham over 7 years
    @DanDascalescu What am I looking for Dan?
  • Ted Bigham
    Ted Bigham over 7 years
    The 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
    Kurkula about 7 years
    file -> default settings -> languages & frameworks -> nodejs and npm -> coding assistance -> Enable
  • Ted Bigham
    Ted Bigham almost 7 years
    @DanDascalescu The question was about WebStorm 7
  • Tom
    Tom over 5 years
    For me, now, the library required was simply "node" in the same spot that @TedBigham mentioned.