Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ inspection saying module.exports does not exist for nodejs

IntelliJ is giving a warning of

Property exports is not defined in type Module

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

like image 438
Dakusan Avatar asked May 09 '17 08:05

Dakusan


People also ask

How module exports work in node JS?

The module. exports is a special object which is included in every JavaScript file in the Node. js application by default. The module is a variable that represents the current module, and exports is an object that will be exposed as a module.

How do I use node js in Intellij Community Edition?

Set up IntelliJ to use Node Go to Preferences > Plugins, then click on the “Browse Repositories” button, then type “NodeJS” into the search box. You should find the following plugin to install: Click “install” to install it.


1 Answers

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).

like image 60
Dakusan Avatar answered Oct 11 '22 15:10

Dakusan