4

I tried to install @material-ui/core librabry but then npm throws the error below

I used the

npm install @material-ui

command

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! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from @material-ui/[email protected]
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"*" 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.
npm ERR! 
npm ERR! See /home/freduah/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/freduah/.npm/_logs/2020-11-02T14_50_03_045Z-debug.log
freduah@freduah:~/school-demo$ ```
1

12 Answers 12

9

I had come across the same problem. These worked for me:

  1. For core: npm -f install @material-ui/core

  2. For icons: npm -f install @material-ui/icons

Sign up to request clarification or add additional context in comments.

1 Comment

But this comes with security vulnerabilities, so if you are working on a production application try to fix them first, for side projects this is okay.
7

You can try to install it by force by adding '-f':

npm install -f @material-ui/core

Comments

3

MaterialUI 4 doesn't support React 17 yet. Please check the issue created on github https://github.com/mui-org/material-ui/issues/23306.

Comments

2

you can downgrade your react, it worked for me by this command:(I downgrade from v17)

npm install --save [email protected] [email protected]

Comments

2

Use this command:

npm install @material-ui/core --force

Comments

1

Material UI is using emotion as a styling engine by default. If you want to use styled-components instead, run:

try to use this npm install @mui/material @mui/styled-engine-sc styled-components

i highly recommend to read the document in thar website and not from npm

Comments

1

This worked for me

npm install -force @material-ui/core

Comments

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

worked for me. Which I found on https://mui.com/

Comments

0

check your react versian, MaterialUI 4 doesn't support React 17. you can change youre version by

  1. npm install --save [email protected] [email protected] make sure Assuming you're using npm/yarn or another node package manager, dependency versions are listed in package.json. Search for the react and react-dom packages under dependencies (or devDependencies) and replace their versions with 16.13.0. Then run npm install or yarn or whatever package manager you're using. This should be enough to downgrade to React 16.

Comments

0

Try yarn add @material-ui/core & yarn add @material-ui/core React 17 dont support material UI install previous versions or use yarn It will take some time but work perfectly fine

Comments

0

Problem: npm install @material-ui/core

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

OR yarn add @mui/material @emotion/react @emotion/styled

Comments

0

npm install -f @material-ui/core

or

npm install @mui/material @emotion/react @emotion/styled --legacy-peer-deps

or You can downgrade react

npm install --save [email protected] [email protected]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.