[Solved] Nodejs/Express: Unresolved function or method


just downloaded latest Webstorm Version and created new empty Project.

After creation i executed: npm init --yes

Added express as dependency in package.json and executed: npm install
Then i've copied this example: https://expressjs.com/en/starter/hello-world.html

I can execute the code but Webstorm shows me this Error:


How can I fix this "error"? I have same issues with pg package




WebStorm 2018.3.1
Build #WS-183.4588.66, built on December 5, 2018
JRE: 1.8.0_152-release-1343-b16 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.19.8-2-MANJARO

Comment actions Permalink

The problem is that these properties are not defined in Express module - they are added dynamically in runtime. That's why WebStorm can't resolve them using static analysis.

Installing express typings (@types/express) should make things better: hit Alt+Enter on "express" in require('express'), choose Install Typescript definitions for better type information.


See https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files

Comment actions Permalink

Thank you! That fixed my issues.

Comment actions Permalink

Boss!  Thank you Elena , learning about alt+enter was a huge bonus.

Comment actions Permalink

it worked! Thank you!

Comment actions Permalink

On macOS use opt + enter to do the same.

Comment actions Permalink

Thank you! Helped me in Intellij too!


Please sign in to leave a comment.