[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
请先登录再写评论。
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: hitAlt+Enter
on"express"
inrequire('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
Thank you! That fixed my issues.
Boss! Thank you Elena , learning about alt+enter was a huge bonus.
Thank you.
it worked! Thank you!
On macOS use opt + enter to do the same.
Thank you! Helped me in Intellij too!