Neha Yadav
Neha Yadav

Reputation: 19

NPM error while running npm install @mui/material @emotion/react @emotion/styled

When I run npm install

PS D:\reactprojects\pinterestclone> npm install @mui/material @emotion/react @emotion/styled

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@"^18.0.0" from the root project
npm ERR!   peer react@">=16.8.0" from @emotion/[email protected]
npm ERR!   node_modules/@emotion/react        
npm ERR!     @emotion/react@"*" from the root project
npm ERR!     peerOptional @emotion/react@"^11.5.0" from @mui/[email protected]
npm ERR!     node_modules/@mui/material       
npm ERR!       @mui/material@"*" from the root project
npm ERR!     1 more (@emotion/styled)
npm ERR!   1 more (@emotion/styled)
npm ERR!
npm ERR! Could not resolve dependency:        
npm ERR! peer react@"^17.0.0" from @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR!   @mui/material@"*" 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 C:\Users\LENOVO\AppData\Local\npm-cache\eresolve-report.txt for a full report. 

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\LENOVO\AppData\Local\npm-cache\_logs\2022-04-02T14_38_20_119Z-debug-0.log

Upvotes: 2

Views: 4794

Answers (2)

HeyVats
HeyVats

Reputation: 11

Material UI and React Js are updating something and for now it's not compatible so you just need to add --force after every command you enter.

Upvotes: 0

Usman Sabuwala
Usman Sabuwala

Reputation: 900

Just add a --force after your install command. Because React 18 was just launched some libraries can't find a way to fit in properly. Run this command

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

Upvotes: 1

Related Questions