Lester
Lester

Reputation: 375

Why Is Mui No Longer Installing?

I am trying to use mui select in my React App. After using

npx create-react-app .

I then use

npm install @mui/material @emotion/react @emotion/styled

to install mui.

After following the steps to install Mui I am getting this error:

Could not resolve following dependency: peer react@"^17.0.0" from @mui/[email protected]

but it is apparently installed in the package.json:

"dependencies": {
..
    "react": "^18.0.0",
..
}

If anyone could help me figure out what's going on here, I'd sure appreciate it.

Upvotes: 1

Views: 803

Answers (2)

Nawfel Sekrafi
Nawfel Sekrafi

Reputation: 81

Try vite, or try again :), by now it's resolved.
I added axios, sass, react-router-dom, @reduxjs/toolkit as well.
this is a good start after creating a brand new react app.

npm i sass axios react-router-dom @reduxjs/toolkit react-redux @mui/material @emotion/react @emotion/styled

Upvotes: 0

Jay
Jay

Reputation: 21

MUI seems to be not ready for React Version 18. The error message says, that Material UI Version 5.5.3 (which is the latest as of 2022-03-31) needs React with major version number 17 as peer dependency.

I hope someone has a better answer, but as of now it seems that we have to wait until the version number of React as peer dependency gets bumped to 18.0.0.

Current progress of the MUI project

Edit: following this Answer you should be able to get it working by using the --legacy-peer-deps flag

npx create-react-app test
cd test
npm install @mui/material @emotion/react @emotion/styled --legacy-peer-deps

Upvotes: 1

Related Questions