'require' keyword not being recognized by webstorm

后端 未结 5 1895
春和景丽
春和景丽 2021-02-01 03:15

I\'m using WebStorm as the IDE.

Here\'s my folder structure and express.js insalled:

\"ente

5条回答
  •  梦谈多话
    2021-02-01 04:02

    In Webstorm, there are three places in your settings (ctrl-alt-s) where you can update settings for Node.js projects.

    Settings: Javascript Libraries

    First, in Javascript | Libraries you can specify that Node libraries should be loaded. Your set of libraries may look different than this, but it should be pretty close...or, if needed, you can add the libraries so that your flavor (node, io, whatever) shows up.

    enter image description here

    JSHint

    Second, if you have JSHint enabled, you should also enable the Node.js environment so that JSHint acts appropriately.

    enter image description here

    Nodejs and NPM Settings

    You can (should) also set the path to your node executable. Webstorm will also detect your globally installed modules, too, and show you if your versions are up-to-date.

    enter image description here

    The Official Docs

    Finally, this reference link contains much more information about WebStorm and Node: JetBrains Webstorm -- Nodejs Docs

提交回复
热议问题