Webstorm 7 cannot recognize node API methods

后端 未结 5 1292
南旧
南旧 2020-12-18 17:48

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 c

相关标签:
5条回答
  • 2020-12-18 18:15

    Updating to Webstorm 8 or higher will fix your require methods problem. As posted earlier by checking if Settings > JavaScript > Libraries > Node.js are all checked will fix your problem

    0 讨论(0)
  • 2020-12-18 18:19

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

    0 讨论(0)
  • 2020-12-18 18:25

    I use WebStorm 2020 and I had everything enabled but WebStill though showed that module.exports is unknown function. Then I turned off NodeJS.core library and NodeJS code assistance, applied and then turned them on again. And suddenly it started to work.

    0 讨论(0)
  • 2020-12-18 18:37

    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.

    0 讨论(0)
  • 2020-12-18 18:40

    For WebStorm 7 thru 10 (on OSX)…

    WebStorm → Preferences → Languages & Frameworks → Javascript → Libraries

    Select "Node.js Globals" and "Node.js vXXX Core Modules".

    0 讨论(0)
提交回复
热议问题