Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ESLint: Error while loading rule 'react/display-name': Cannot find module 'react' from '/home/...'. #2346

Closed
sgehrman opened this issue Jul 12, 2019 · 14 comments

Comments

@sgehrman
Copy link

This version works:
"eslint-plugin-react": "7.11.1",

But new versions are broken. My project is a bit non standard. We have the package.json inside the source folder, so it seems the new versions don't find it in this case, but it has worked fine when using 7.11.1

@ljharb
Copy link
Member

ljharb commented Jul 12, 2019

are you on eslint 5 or 6? eslint 6 made some changes that tend to force standard configurations.

@sgehrman
Copy link
Author

I'm using 5.16.0

@ljharb
Copy link
Member

ljharb commented Jul 15, 2019

Can you explain a bit about your project layout, including where package.json and your eslint config lives, and where you ran the eslint command?

@alyrik
Copy link

alyrik commented Jul 16, 2019

@sgehrman, I faced the same today. The cause was a corrupted react module in node_modules. It was partly deleted after installing eslint-plugin-jsx-a11y. Try to remove node_modules and reinstall it.

@EddyLuten
Copy link

I am facing the same issue as OP (using eslint 5.16.0), downgrading to 7.11.1 worked for me as well.

@HofmannZ
Copy link

I can confirm downgrading eslint-plugin-react to 7.11.1 while running ESLint 6.0.1 is a temporary work around.

The following PRs have been merged since 7.11.1: #2225, #2137, #2109, #2002 and #1098.

@lbebber
Copy link

lbebber commented Jul 18, 2019

As for myself, downgrading to 7.13.0 was enough. This issue starts appearing at 7.14.0.

@lbebber
Copy link

lbebber commented Jul 18, 2019

It seems the error is being caused by this commit specifically golopot@bdd61922d373f71d8

@ljharb
Copy link
Member

ljharb commented Jul 18, 2019

ah - that might be fixed in #2336 / #2276, just unreleased.

@michaellopez
Copy link

@ljharb any info on when a new release containing that fix will be published?

@yannickcr
Copy link
Member

@michaellopez I just published v7.14.3 with the fix 🙂

@geoseong
Copy link

I just remove and reinstall, problem solved. my version is 7.12.4

"eslint-plugin-react": "^7.12.4",

@devuxer
Copy link

devuxer commented Feb 22, 2024

I just ran into this with the latest version. I tried (1) restarting VSCode and (2) deleting node_modules and re-running npm install, but neither of those helped. Finally, I tried downgrading to 7.11.1, running eslint, then updating to latest, and running again. This worked!

(Perhaps the issue is caused by trying to run eslint with a much newer version than it was previously run. Maybe you need to run with a somewhat newer version before just suddenly upgrading to the latest version like a crazy person. I'm sorry, I'm just making this up. I have no idea 🤷‍♂️🤷‍♂️🤷‍♂️.)

@ljharb
Copy link
Member

ljharb commented Feb 22, 2024

@devuxer you should be able to upgrade to latest eslint 7 just fine. upgrading to eslint 8 might be trickier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

10 participants