Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui] npm install fails when "@mui/material" set to "latest" and no specific React version #44866

Closed
DiegoAndai opened this issue Dec 27, 2024 · 2 comments · Fixed by #44867
Assignees
Labels
bug 🐛 Something doesn't work

Comments

@DiegoAndai
Copy link
Member

DiegoAndai commented Dec 27, 2024

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/vitejs-vite-qtsu7a5s?file=index.html,package.json&terminal=dev
  2. Run npm install

Current behavior

There's two ways of reproing. The one on the live example is having:

  "dependencies": {
    "@mui/material": "latest"
  }

The other one is having

  "dependencies": {
    "@mui/material": "latest",
    "react": "latest",
    "react-dom": "latest"
  }

Expected behavior

It should successfully install.

The error doesn't happen when specifying the react version:

  "dependencies": {
    "@mui/material": "latest",
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  }

or

  "dependencies": {
    "@mui/material": "latest",
    "react": "^18.0.0",
    "react-dom": "^18.0.0"
  }

Your environment

npx @mui/envinfo
  System:
    OS: Linux 5.0 undefined
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  Browsers:
    Chrome: Not Found

Search keywords: npm install react ERESOLVE

@DiegoAndai DiegoAndai added the bug 🐛 Something doesn't work label Dec 27, 2024
@DiegoAndai DiegoAndai self-assigned this Dec 27, 2024
@DiegoAndai DiegoAndai moved this to In progress in Material UI Dec 27, 2024
@DiegoAndai
Copy link
Member Author

This is due to npm install always installing peer dependencies, and:

Because of this, "react-dom" resolves to latest (19) but "react" resolves to 18, causing the mismatch.

Updating our dependency to @pigment-css/[email protected] should fix it.

This was referenced Dec 27, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Material UI Dec 27, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant