node-express app.get() marked as unresolved in webstorm

后端 未结 3 1285
[愿得一人]
[愿得一人] 2021-02-01 02:26

If you follow JetBrains\' Getting Started with Node.js in WebStorm instructions, node-express specific code is highlighted correctly. However if you create your own simple node-

相关标签:
3条回答
  • 2021-02-01 02:34

    Instead of express definitelyTyped, use express types in your project:

    npm install --save-dev @types/express
    

    Alternatively, for yarn users:

    yarn add --dev @types/express
    
    0 讨论(0)
  • 2021-02-01 02:47

    This worked great for me.

    TL;DR: you go to Settings/Preferences --> Languages and Frameworks --> JavaScript --> Libraries, click the Download button on the right, then select "express" (or any other library you need) and click Download and Install.

    0 讨论(0)
  • 2021-02-01 02:50

    Enabling express-DefinitelyTyped typescript library for Express project does work for me - app.get() is successfully resolved. Adding typescript stubs is the only possible workaround, as WebStorm can't understand the way express is defined - see https://youtrack.jetbrains.com/issue/WEB-6667#comment=27-470393

    If adding typescript stubs doesn't work for you, please try invalidating caches. If this doesn't help, I'd suggest contacting jetbrains support, providing a sample project

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