I have been trying to download a template to start customizing it. Upon downloading it, one is supposed to install all local dependencies using npm install or yarn install. I have done both of those and I have gotten the same error both times. Moreover I have tried using the same command with --force and --legacy-peer-deps, as advised in the error message. I found a GitHub issue discussing this precise problem and some other stack overflow threads. I have tried everything I have come across, and it is just not working. Moreover I have installed the recommended version of node, so that is not the problem either, as suggested in a different thread.
The error message can be seen below.
While resolving: @mui/material@5.2.0
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.2.0
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"5.2.0" 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.2.0
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"5.2.0" from the root project
npm ERR! peer @mui/material@"^5.0.0" from @mui/icons-material@5.2.0
npm ERR! node_modules/@mui/icons-material
npm ERR! @mui/icons-material@"5.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @emotion/react@11.7.1
npm ERR! node_modules/@emotion/react
npm ERR! peerOptional @emotion/react@"^11.5.0" from @mui/material@5.2.0
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"5.2.0" from the root project
npm ERR! peer @mui/material@"^5.0.0" from @mui/icons-material@5.2.0
npm ERR! node_modules/@mui/icons-material
npm ERR! @mui/icons-material@"5.2.0" 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.
The template: https://www.creative-tim.com/product/material-dashboard-react?ref=readme-mdr#
GitHub issue: https://github.com/creativetimofficial/material-dashboard-react/issues/171
Thanks in advance.
The problem is that the specific version of @emotion/react used in the template, is not working anymore.
To solve the problem I went to the package.json and changed the version from 11.4.1 to 11.5.0 manually. Seems that the 11.5.0 solves the problem with the template used.
upgrade your version from package.json file and run again "npm install" command