skip to Main Content

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@"^16.8.0 || ^17.0.0" from
@material-ui/[email protected]

I am getting this error while installing material ui through npm. Please help me with the installation procedure of the same.

3

Answers


  1. Make sure you are installing in the folder that contains your package.json file

    Login or Signup to reply.
  2. Add –legacy-peer-deps like this:
    npm install @mui/material @emotion/react @emotion/styled –legacy-peer-deps

    Login or Signup to reply.
  3. You can try using the command below:

    npm install @material-ui/core --force
    

    Or use legacy-peer-deps

    npm install @material-ui/core --save --legacy-peer-deps
    

    One more issue may be your React version or node js version.If your node version is 12 try upgrading to version 16.You can do it using NVM.Using it you can manage multiple node versions in one machine.After installations use following command to use specific node version:

    nvm use vA.B.C
    

    One more solution is to clean cache using

    npm cache clean --force 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search