mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.75k stars 32.24k forks source link

Cannot install React RC with Material UI #44203

Open mj-manna opened 1 day ago

mj-manna commented 1 day ago

Steps to reproduce

npm install @mui/material @emotion/react @emotion/styled npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: my-app@0.1.0 npm ERR! Found: react@19.0.0-rc-69d4b800-20241021 npm ERR! node_modules/react npm ERR! react@"19.0.0-rc-69d4b800-20241021" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^17.0.0 || ^18.0.0 || ^19.0.0" from @mui/material@6.1.5 npm ERR! node_modules/@mui/material npm ERR! @mui/material@"*" 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! npm ERR! For a full report see: npm ERR! /home/user/.npm/_logs/2024-10-24T11_03_10_171Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2024-10-24T11_03_10_171Z-debug-0.log

Current behavior

No response

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: Nextjs

Search keywords:

LukasTy commented 1 day ago

Hello. Are you sure the problem is related to Next 15? To me, it seems that you are trying to install @mui/material v6 with a pre-release version react of which your package manager complains:

npm ERR! ERESOLVE unable to resolve dependency tree
...
npm ERR! react@"19.0.0-rc-69d4b800-20241021" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.0 || ^18.0.0 || ^19.0.0" from @mui/material@6.1.5

Using React v18.x should avoid this problem. 🤔

I'm transferring the issue to the material-ui repo as it is base of the problem.

mj12albert commented 1 day ago

@mj-manna Would you mind sharing a repro?

beverloo commented 1 day ago

One issue is that the @mui/material-nextjs package requires Next.js 13 or 14 as a peer dependency, not 15: https://github.com/mui/material-ui/blob/master/packages/mui-material-nextjs/package.json

NebulaRobot commented 22 hours ago

Exactly the same problem.

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: mpb-benchmark-frontend@0.1.0
npm error Found: react@19.0.0-rc-65a56d0e-20241020
npm error node_modules/react
npm error   react@"19.0.0-rc-65a56d0e-20241020" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^17.0.0 || ^18.0.0 || ^19.0.0" from @mui/material@6.1.5
npm error node_modules/@mui/material
npm error   @mui/material@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
siriwatknp commented 21 hours ago

I am fixing this.

github-actions[bot] commented 20 hours ago

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.

[!NOTE] @mj-manna How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

siriwatknp commented 20 hours ago

This is fixed from our side but the error is still shown with Emotion because the current Next.js uses React release candidate version which is not working with Emotion's peerDependency `">=16.8.0"

Ref: https://github.com/npm/cli/issues/4958

The workaround is to run npm install --legacy-peer-deps