Property module is not defined in type module

Any idea why Webstorm does not recognize the `module.exports`?

 

 

WebStorm 2018.3.4
Build #WS-183.5429.34, built on January 30, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3

 

8 comments

Please make sure that Coding assistance for Node.js  is enabled in Settings | Languages & Frameworks | Node.js and NPM

0

please try clearing the Coding assistance for Node.js checkbox, apply changes, then re-open settings and re-enable the checkbox - does it help? Also, did you try invalidating caches?

0

Well, it did not fix the problem. See the video: https://monosnap.com/file/OPP7Xqdxx28o8osXIbjw2ZiNRsqRT4

 

Just in case I created a new Express project from Webstorm and it works, but if I create an Empty project adds package.json on it, it does not work. Is that expected?

0

I also realized that in my project that module comes from repl.js

In the new express project, I have created it comes from globals.d.ts

0

>I also realized that in my project that module comes from repl.js

that's the reason - `module` is resolved to the corresponding module in your library instead of the node.js built-in type, so the IDE suggests to import it - it's expected...

1

There is some way to force Webstorm to suggest it from node.js built-in type?

0

excluding the file (`repl.js`) module is defined in should help: you can either mark the module folder excluded, or mark the file as text using right-click menu

1

Please sign in to leave a comment.