question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install @material-ui/core with npm 7 and React 17

See original GitHub issue

On the base template of create-react-app v4 with typescript material-ui/core complains about the version of react.

Steps to Reproduce 🕹

Step 1: Run - npx create-react-app . --template typescript Step 2: Run - npm i @material-ui/core

Error fron console

npm ERR! Found: react@17.0.1
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/core@4.11.0
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"*" from the root project 
  • [ x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

material ui core does not install

Expected Behavior 🤔

isntall material-ui core

Your Environment 🌎

Fresh linux Ubuntu installation. 20.10

Tech Version
Material-UI default LTS
React 17.0.1
TypeScript true
Node 15.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:27
  • Comments:27 (12 by maintainers)

github_iconTop GitHub Comments

18reactions
echocrowcommented, Nov 2, 2020

I encountered the same error the other day (also after scaffolding via CRA & TypeScript as seen in OP). Using npm v7.0.3 does yield additional output:

npm install --save @material-ui/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! [...]
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.

Following the instructions I ran

npm install --save --legacy-peer-deps @material-ui/core

and Material UI installed fine without downgrading npm or React.

DISCLAIMER: Use at own risk. Things may break. Material UI v4 does not officially support React v17. You’re encouraged to either switch to React v16 or wait for Material UI v5.

I’ve only tested a few components and features. Everything seems fine so far, but I don’t know whether there are any lurking compatibility issues between @material-ui/core@"v4.11.0" and react@"^17.0.1" at this point. Do proceed with caution until v5 (or potential official support in v4?) gets released.

6reactions
dcsancommented, Nov 25, 2020

i think create-react-app is now defaulting to react v17, and it looks from above like nextJS does too. so expect a lot more duplicated issues I guess?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot install @material-ui/core with npm 7 and React 17
On the base template of create-react-app v4 with typescript material-ui/core complains about the version of react.
Read more >
cannot install @material-ui/core using npm - Stack Overflow
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 ...
Read more >
@material-ui/core - npm
React components that implement Google's Material Design.. Latest version: 4.12.4, last published: 9 months ago.
Read more >
Installation - Material UI - MUI
Install Material UI, the world's most popular React UI framework. Default installation. Run one of the following commands to add Material UI to...
Read more >
@material-ui/core | Yarn - Package Manager
Material UI v4 doesn't receive active development since September 2021. ... React components that implement Google's Material Design. react, react-component ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found