After updating to CRA 5.0.0, I got this error on compilation process:
ERROR in Plugin "react" was conflicted between ".eslintrc.json" and "BaseConfig » "..\react-app\node_modules\eslint-config-react-app\base.js".
My eslint configuration is:
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:react/jsx-runtime"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {...}
}
Any solutions/fixes?
Well, this seems to be related to one of the following issues.
https://github.com/yannickcr/eslint-plugin-react/issues/3128
https://github.com/facebook/create-react-app/issues/10463
What you can try is the following (if the first one does not work, try the second one, if you are using yarn):
pnpFallbackMode: all to .yarnrc.yml file, if you are using yarn, as explained here https://github.com/facebook/create-react-app/issues/10463#issuecomment-997378138In addition, take a look the CRA release notes to check if some action is required, especially the part about "Migrating from 4.0.x to 5.0.0", you may need to update react-scripts as well.
https://github.com/facebook/create-react-app/releases/tag/v5.0.0
I just tried to use your config in my project (which is working with CRA 5.0.0) and didn't receive this error. I think the problem is that you didn't update one or several eslint-related packages. You can try to update them:
yarn add -D \
eslint@^8.6.0 \
@typescript-eslint/eslint-plugin@^5.9.0 \
@typescript-eslint/parser@^5.9.0 \
eslint-plugin-react@^7.28.0 \
eslint-config-react@^1.1.7 \
eslint-config-airbnb@^19.0.4
or npm install instead of yarn add if you are using npm
I think it's because of not an updated eslint. Just changing the eslint version to 8.0.0 from 7.0.0 in your package.json worked for me or you update in your cli using npm.
This probably won't help OP, but in my case, I'd updated my react app to MUI 5 and eslint from ^7.32.0 to ^8.7.0 but I forgot to upgrade eslint-plugin-react and eslint-plugin-react-hooks and the above error was happening on file change on reload. Upgrading them to ^7.28.0 and ^4.3.0 respectively fixed my problem.
I've just downgraded eslint-config-react-app from version 7.0.0 to 6.0.0:
yarn add --dev eslint-config-react-app@6.0.0
or
npm install --dev eslint-config-react-app@6.0.0
Maybe this will help someone.
Today i ran into the problem and after i ran an audit fix--force the npm start didnt work but i got a lovely long message which explains the steps and also the reason behind this. I found it helpful and fixed my problem.
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.6.0"
Don't try to install it manually: your package manager does it automatically. However, a different version of eslint was detected higher up in the tree:
C:\Users\rohad\Desktop\project\node_modules\eslint (version: 8.10.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
- Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
- Delete node_modules in your project folder.
- Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
- Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem. If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead. This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\Users\rohad\Desktop\project\node_modules\eslint is outside your project directory. For example, you might have accidentally installed something in your home folder.
Try running npm ls eslint in your project folder. This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
In my case, everything was updated to the latest version, but still I got the same error.
After I deleted the lock file it started working