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

 

16 comments
Comment actions Permalink

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

0
Comment actions Permalink

Yes, It's enabled

 

0
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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

1
Comment actions Permalink

>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
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

well, I see a lot of people has the same problem and I found the solution.

just close your project and

From here Click Configure and go to Preferences > Languages & Frameworks > Node.js   from here my checkmark was disabled and also package manager field was empty so set them all and reset the IDE and good to go at least for me it worked.

5
Comment actions Permalink

@asmohammad001 thx, your solution worked for me too

2
Comment actions Permalink

Absolutely the same here and Asmohammad001's solution worked.

0
Comment actions Permalink

Asmohammad001 solution did not work for me, as my nodejs was already checked. any other solution☹️

0
Comment actions Permalink

Trapcode Io did you try to uncheck it and save and check and save it again?  sometimes it shows checked but it's not.

0
Comment actions Permalink

It's trully a bullshit. In year 2020 and for paid software there shouldn't be any solution like: "Enable, disable and enable it again or if you get to preferences this way it wouldn't work, but if you go there other way, maybe. Not sure, but maybe you're lucky. Who knows how this works. Jetbrains does not like it seems". WTF???

What is going on? Are unable to get the basics working?

Tons of some exotic stuff is there and it get's more and more, but the basics don't work? Really? 

I have this issue two. I had webstorm, datagrid and phpstorm in my subscription. Know I have only the phpstorm. If this will be your way, you will lost me as customer completely. 

 

FIX THIS

1
Comment actions Permalink

I just got out of a similar rough patch with bcrypt's module type interfering with NodeModule. My hack was unchecking server/node_modules from the Libraries menu in my IDE settings, which is the directory bcrypt happened to be installed in. Checking through my project the warning messages are finally gone, but your mileage may vary based on how your particular project is structured.

0

Please sign in to leave a comment.