Error while installing node_modules in a project

Viewed 181
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @mui/material@5.1.1
npm ERR! Found: @emotion/react@11.4.1
npm ERR! node_modules/@emotion/react
npm ERR!   @emotion/react@"11.4.1" from the root project
npm ERR!   peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.3.0
npm ERR!   node_modules/@emotion/styled
npm ERR!     @emotion/styled@"11.3.0" from the root project
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.1.1
npm ERR!     node_modules/@mui/material
npm ERR!       @mui/material@"5.1.1" from the root project
npm ERR!       1 more (@mui/icons-material)
npm ERR!     1 more (@mui/styled-engine)
npm ERR!   1 more (@mui/styled-engine)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @emotion/react@"^11.5.0" from @mui/material@5.1.1
npm ERR! node_modules/@mui/material
npm ERR!   @mui/material@"5.1.1" from the root project
npm ERR!   peer @mui/material@"^5.0.0" from @mui/icons-material@5.1.1
npm ERR!   node_modules/@mui/icons-material
npm ERR!     @mui/icons-material@"5.1.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @emotion/react@11.8.1
npm ERR! node_modules/@emotion/react
npm ERR!   peerOptional @emotion/react@"^11.5.0" from @mui/material@5.1.1
npm ERR!   node_modules/@mui/material
npm ERR!     @mui/material@"5.1.1" from the root project
npm ERR!     peer @mui/material@"^5.0.0" from @mui/icons-material@5.1.1
npm ERR!     node_modules/@mui/icons-material
npm ERR!       @mui/icons-material@"5.1.1" 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\Anupam K Krishnan\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\Anupam K Krishnan\AppData\Local\npm-cache\_logs\2022-03-03T10_39_28_145Z-debug-0.log
  • Have a prebuilt app and it's throwing error while installing node modules
  • there are dependencies error
  • I went through the error but couldn't rectify it
  • Please tell how can I solve this error
1 Answers

Faced the exactly the same issue today. Updated emotion/react to 11.8.1(latest) then mui/icons-material and mui/material to 5.5.0 in package.json file found in the root of the project. AFter this i ram "npm i" and it worked.

Related