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

Created on 13 Jul 2019  路  12Comments  路  Source: yannickcr/eslint-plugin-react

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

bug help wanted question

Most helpful comment

@michaellopez I just published v7.14.3 with the fix 馃檪

All 12 comments

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

I'm using 5.16.0

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?

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

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

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.

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

It seems the error is being caused by this commit specifically https://github.com/golopot/eslint-plugin-react/commit/bdd61922d373f71d8

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

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

@michaellopez I just published v7.14.3 with the fix 馃檪

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

"eslint-plugin-react": "^7.12.4",
Was this page helpful?
0 / 5 - 0 ratings