skip to Main Content

Got that log during the deployment process on Vercel:

Installing dependencies...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @material-ui/[email protected]
npm ERR! Found: @types/[email protected]
npm ERR! node_modules/@types/react
npm ERR!   dev @types/react@"^18" from the root project
npm ERR!   peerOptional @types/react@"*" from @material-ui/[email protected]

npm ERR! Could not resolve dependency:
npm ERR! peerOptional @types/react@"^16.8.6 || ^17.0.0" from @material-ui/[email protected]

npm ERR! Conflicting peer dependency: @types/[email protected]
npm ERR! node_modules/@types/react
npm ERR!   peerOptional @types/react@"^16.8.6 || ^17.0.0" from @material-ui/[email protected]

My dependencies:

"@material-ui/core": "^4.12.4", "@mui/system": "^5.15.7", "@types/react": "^17.0.0",

2

Answers


  1. Assuming everything is working on your local machine and the project builds on your local machine.

    And if this error is only happening on a deployment platform then simply remove ^ from
    "@types/react": "^17.0.0" so your package.json will look like

    "@types/react": "17.0.0"
    "@material-ui/core": "4.12.4"
    "@mui/system": "5.15.7"
    

    and try to redeploy again


    Basically what ^ symbol means is telling the deployment platform in your case Vercel, "I use version 17, but you can use the latest version of this dep (version 18 in your case)", which seems to cause compatibility issues with other dependencies which have not upgraded their dependencies

    I use this very helpful tool I found for navigating the dependency hell that is javascript

    https://marketplace.visualstudio.com/items?itemName=pflannery.vscode-versionlens

    Hope this helps.

    Login or Signup to reply.
  2. It looks like you’re trying to use @types/react@^18.0.0. Try reinstalling @types/react@^17.0.0

    npm i -d @types/react@^17.0.0
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search