Harsha Buggi
Harsha Buggi

Reputation: 1

NodeJS - Unable to get latest react verion installed with mui version 5 on Node version 20.9.0

Unable to get latest mui version with latest react on node 20.9.0

Steps I followed

  1. npx create-react-app my-project
  2. cd my-project
  3. npm install @mui/material @emotion/react @emotion/styled

No issues till here .. but then if I run this I get error

  1. npm install @mui/base @mui/core @mui/icons-material @mui/styles
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.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.2" from @mui/[email protected]
npm ERR! node_modules/@mui/core
npm ERR!   @mui/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! 
npm ERR! For a full report see:
npm ERR! /home/abcd/.npm/_logs/2024-03-16T17_22_45_664Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/abcd/.npm/_logs/2024-03-16T17_22_45_664Z-debug-0.log

How do I resolve this issue ?

Upvotes: 0

Views: 105

Answers (1)

Yuvaraj M
Yuvaraj M

Reputation: 4618

You already have the solution on the error.

npm install will fail when it encounters conflicting peerDependencies, here @mui/core

$ npm i @mui/base @mui/core @mui/icons-material @mui/styles --legacy-peer-deps

--legacy-peer-deps ignore all peerDependencies while installing.

Upvotes: 0

Related Questions