0

npm install @material-ui/core is showing error while installing. I used other commands also to install but still showing errorenter image description here

2 Answers2

0

material-ui uses react versions 16 or 17 as the peer dependencies even if you've react version 18 in your root project. You can run npm install with following configuration in order to avoid peer dependency auto installation and do the installation the way it was with npm v4 through v6.

npm config set legacy-peer-deps true
npm install

Please read this for more info. on --legacy-peer-deps flag.

Kavindu Vindika
  • 2,449
  • 1
  • 13
  • 20
0

Try this

npm config set legacy-peer-deps true
npm i
  • `npm i` is the same as `npm install` since `i` [is an alias](https://docs.npmjs.com/cli/v8/commands/npm-install) of `install`. As such, this answer duplicates [the earlier answer](https://stackoverflow.com/a/73316081/1364007) and should be deleted. – Wai Ha Lee Aug 12 '22 at 07:48