How to update pre-existing dependency when using create-react-app?

Viewed 3276

I am using create-react-app for a project. I installed various eslint plugins etc, however, we all know that create-react-app already comes with certain dependencies that are not shown in package.json.

I want the newest eslint version which is currently 5.3.0. Create-react-app comes with 5.16.0. WITHOUT EJECTING, how do I bring this dependency to the newest version without breaking everything?

I get the following error:

The react-scripts package provided by Create React App requires a dependency:

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

:\node_modules\eslint (version: 5.3.0)
2 Answers

Things in package.json will take precedence so if you upgrade version of eslint, react-scripts should always take the latest version.

There is a small loophole though. If you fiddle too much with dependencies you might get the warning about mismatch version by react-scripts. To avoid that you can create .env file and can specify the following.

SKIP_PREFLIGHT_CHECK=true

I just solved this issue, the error says: The react-scripts package provided by Create React App requires a dependency: "eslint": "5.16.0"

but also says you have another version at package.json that's \node_modules\eslint (version: 5.3.0) in my case was 6.1.0

so my solution was: I searched for the dependency called eslint and updated the version similar to Create React App expected "eslint": "^5.16.0" at package.json Then run npm install and now you can run npm start... if you have troubles with slint-plugin-import just update the version as well.

Related