asem shaat
asem shaat

Reputation: 113

Can't npm start my React project with eslint dependencies

I installed eslint in my react project to fix all the eslint errors. I fixed all the errors, however, I can't npm start the project. When I do that, I get this error, and some steps to uninstall all the eslint dependencies. I want to run the project with eslint dependencies.

Please let me know how to do this?

Error Message:

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": "^7.11.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:

Upvotes: 0

Views: 1577

Answers (2)

whygee
whygee

Reputation: 1984

My guess would be that you installed eslint@v8 and since create-react-app doesn't support it yet (reference) it causes this error.

Downgrading to eslint v7 should fix it.

Upvotes: 1

Duenna
Duenna

Reputation: 2376

Create react app already comes bundled with eslint and by installing it in the project dependencies, you are in effect try to load in conflicting versions, you shouldn't need eslint inside of your own package.json.

HOWEVER

If you want to override eslint and start customising your react install you are more than welcome to eject (npm run eject), but bear in mind that ejecting your application will mean you will need to maintain dependencies going forwards.

You can read more about ejecting here - https://create-react-app.dev/docs/available-scripts/

Upvotes: 0

Related Questions