[Solved] Nodejs/Express: Unresolved function or method

Hello,

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

 

BR

 

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

6
7 comments

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

21

Thank you! That fixed my issues.

3

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

1

it worked! Thank you!

0

On macOS use opt + enter to do the same.

0

Thank you! Helped me in Intellij too!

0

Please sign in to leave a comment.