Aidenhsy
Aidenhsy

Reputation: 1601

Cannot install @material-ui/pickers (ERESOLVE unable to resolve dependency tree)

I am trying to install the library @material-ui/pickers by running:

npm i @material-ui/pickers

But this error shows up:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!   peer react@"^16.8.0 || ^17.0.0" from @material-ui/[email protected]
npm ERR!   node_modules/@material-ui/core
npm ERR!     @material-ui/core@"^4.11.3" from the root project
npm ERR!     peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]
npm ERR!     node_modules/@material-ui/pickers
npm ERR!       @material-ui/pickers@"*" from the root project
npm ERR!   1 more (react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.4" from @material-ui/[email protected]
npm ERR! node_modules/@material-ui/pickers
npm ERR!   @material-ui/pickers@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Here are my package.json dependencies:

 "dependencies": {
    "@material-ui/core": "^4.11.3",
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.3",
    "@testing-library/user-event": "^12.6.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.1",
    "web-vitals": "^0.2.4"
  },

I thought there was maybe some problems in other parts of my file, so I started a create-react-app from scratch and tried again, but the same error is still occuring.

Upvotes: 2

Views: 4592

Answers (3)

Robin Wieruch
Robin Wieruch

Reputation: 15908

Perhaps you want to check out the new Material UI DatePicker from over here. If I understood correctly@material-ui/pickers isn't used anymore.

Upvotes: 2

Namrata Sanger
Namrata Sanger

Reputation: 105

I even had this error and what I did was simply closed my VScode because the project was open in it and again tried to install the package and guess what it works. You can try this solution hopefully it works.

Upvotes: 0

kunquan
kunquan

Reputation: 1267

@material-ui/pickers required react to be 16.13.1 or higher but not to 17.xx.xx. Right now you are using React version 17.0.1. You can try to downgrade the React to version 16 and see if it works

Upvotes: 0

Related Questions