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] Next.js npm i throws peer dependency error #44406

Closed
PTCoyer opened this issue Nov 13, 2024 · 3 comments
Closed

[material-ui] Next.js npm i throws peer dependency error #44406

PTCoyer opened this issue Nov 13, 2024 · 3 comments
Assignees
Labels
bug 🐛 Something doesn't work external dependency Blocked by external dependency, we can’t do anything about it nextjs package: material-ui Specific to @mui/material

Comments

@PTCoyer
Copy link

PTCoyer commented Nov 13, 2024

Related page

https://mui.com/material-ui/integrations/nextjs/

Kind of issue

Broken demo

Issue description

dependancy error when attempting install of mui in nextjs using command:
npm install @mui/material-nextjs @emotion/cache
npm error peer react@">=16.8.0" from @emotion/[email protected]
npm error node_modules/@emotion/react
npm error peer @emotion/react@"^11.11.4" from @mui/[email protected]
npm error node_modules/@mui/material-nextjs
npm error @mui/material-nextjs@"*" from the root project

Context

attempting to install mui in a nextjs project

Search keywords: react 19 nextjs mui react 16 react

@PTCoyer PTCoyer added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Nov 13, 2024
@mnajdova mnajdova added nextjs and removed support: docs-feedback Feedback from documentation page labels Nov 14, 2024
@mnajdova mnajdova moved this to Selected in Material UI Nov 14, 2024
@DiegoAndai
Copy link
Member

DiegoAndai commented Nov 15, 2024

Hey @PTCoyer, thanks for the report.

I can confirm this issue, as npm doesn't recognize React's RC versions (for example 19.0.0-rc.1) as part of the ^19.0.0 range.

May I ask you to try using the --force flag when running npm i? You can also try yarn or pnpm and see if the problem goes away. This is to confirm that the issue is the same.

@DiegoAndai DiegoAndai added bug 🐛 Something doesn't work external dependency Blocked by external dependency, we can’t do anything about it package: material-ui Specific to @mui/material and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 15, 2024
@DiegoAndai DiegoAndai moved this from Selected to In progress in Material UI Nov 15, 2024
@DiegoAndai DiegoAndai changed the title NextJS mui npm i issues [material-ui] NextJS npm i throws dependency error Nov 15, 2024
@DiegoAndai DiegoAndai changed the title [material-ui] NextJS npm i throws dependency error [material-ui] NextJS npm i throws dependency error Nov 15, 2024
@oliviertassinari oliviertassinari changed the title [material-ui] NextJS npm i throws dependency error [material-ui] Next.js npm i throws peer dependency error Nov 18, 2024
@oliviertassinari oliviertassinari added the React 19 support PRs required to support React 19 label Nov 18, 2024
@DiegoAndai DiegoAndai removed the React 19 support PRs required to support React 19 label Nov 20, 2024
@DiegoAndai
Copy link
Member

Hey @PTCoyer, and anyone who finds this issue.

The root cause is npm doesn't consider 19.0.0-rc.* to be a valid ^19.0.0 version. If you need React 19 before it becomes stable, you have the following options:

  • Run npm install with --force or --legacy-peer-deps flags. If React is the only dependency you're having issues with, then this is safe to do. That's why yarn and pnpm allow it.
  • Use yarn or pnpm instead of npm

This issue should stop happening once React 19 is stable.

I wouldn't consider this an issue on Material UI's side, and there are two possible workarounds, so I'm closing it.

@github-project-automation github-project-automation bot moved this from In progress to Done in Material UI Nov 20, 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.

Note

@PTCoyer 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work external dependency Blocked by external dependency, we can’t do anything about it nextjs package: material-ui Specific to @mui/material
Projects
Status: Done
Development

No branches or pull requests

4 participants