14

IntelliJ is giving a warning of

Property exports is not defined in type Module

wherever I use module.exports= anywhere in the project.

Dakusan
  • 6,504
  • 5
  • 32
  • 45

2 Answers2

30

In my case the bcrypt nodejs module has a file called "minimal-env.js" in its source which has the line var module; in it. IntelliJ was treating this as the proper definition of "module" for whatever reason. Just commenting out this line fixed the problem. If this happens to you too, try going to the declaration of "module" (ctrl+left-click on it).

Dakusan
  • 6,504
  • 5
  • 32
  • 45
  • 22
    Instead of modifying file in node_modules folder, I used 'Mark as Plain Text' context menu action for `minimal-env.js` file, thus stopping IDE from indexing that file. – ankhzet Mar 25 '19 at 11:51
  • That is a good alternative that I upflagged you for, but it does also carry the problem that the autocompletion for that file’s functions and classes will no longer be available. – Dakusan Apr 03 '19 at 03:26
  • Most of developers, probably, wouldn't want it anyway. It's just some weird incarnation of type-defining stub (AFAIKT) – ankhzet Apr 03 '19 at 12:49
4

I know that's so late for it, but in case somebody else has the same issue.

In my case, I enabled the "Coding assistance for Node.js" under "Languages & Frameworks" but it doesn't work until I close all the projects and enable it on the welcome screen > configure > Preference

Hope it helps.

enter image description here enter image description here enter image description here enter image description here

The under line is gone. enter image description here

Ming Chu
  • 1,315
  • 15
  • 13