I want to use material-ui core and material-ui icons so I am trying to install both with this command: npm install @material-ui/core @material-ui/icons But I am facing the following error: npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 in ReactJS. We are going to Learn about All Possible Solutions So Lets Get Start with This Article.
- How npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error Occurs?
- How To Solve npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error?
- Solution 1: Install with –legacy-peer-deps
- Solution 2: Install with –force
- Summary
How npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error Occurs?
I want to use material-ui core and material-ui icons so I am trying to install both with this command.
npm install @material-ui/core @material-ui/icons
But I am facing following error:
npm ERR! Could not resolve dependency:
npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3
npm ERR! node_modules/@material-ui/core
npm ERR! peer @material-ui/core@”^4.0.0″ from @material-ui/icons@4.11.2
npm ERR! node_modules/@material-ui/icons
npm ERR! @material-ui/icons@”*” 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.
So here I am writing all the possible solutions that I have tried to resolve this error.
How To Solve npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error?
How To Solve npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error?
To Solve npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error Just run the installation command with the –force command and your error will be solved. just run this command: npm install @mui/material @emotion/react @emotion/styled –force
npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3
To Solve npm ERR! Could not resolve dependency: npm ERR! peer react@”^16.8.0 || ^17.0.0″ from @material-ui/core@4.12.3 Error As Error Suggested You need to run the installation command with –legacy-peer-deps and Your error will be solved. First of all run this command: npm install @mui/material @emotion/react @emotion/styled –legacy-peer-deps Then run this command: npm install @mui/icons-material –legacy-peer-deps Now, you’ll be able to use MUI in your react app and your error is resolved. Thank you.
Solution 1: Install with –legacy-peer-deps
As Error Suggested You need to run the installation command with –legacy-peer-deps and Your error will be solved. First of all run this command.
npm install @mui/material @emotion/react @emotion/styled --legacy-peer-deps
Then run this command.
npm install @mui/icons-material --legacy-peer-deps
Now, you’ll be able to use MUI in your react app and your error is resolved. Thank you.
Solution 2: Install with –force
Just run the installation command with the –force command and your error will be solved. just run this command.
npm install @mui/material @emotion/react @emotion/styled --force
Summary
It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read
Thank you very much, these solutions are very useful.
It’s my Pleasure to Help You Samah Ahmed. Thank You For Your Valuable words.
Thank you! I encountered the same error and didn’t know what to. Solution 1 worked for me with ease.
It’s my Pleasure to Help You Paul Aldrin. Thank You For Your Valuable words.
great bro keep going
It’s my Pleasure to Help You Rishad. Thank You So Much For Your Valuable words.