question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@mui/lab has a peer dependency conflict with React 18

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

It appears the lab has dependency conflict as shown below

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @mui/x-date-pickers@5.0.0-alpha.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN   react@"18.0.0" from the root project
npm WARN   15 more (@emotion/react, @emotion/styled, @mui/base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^17.0.2" from @mui/x-date-pickers@5.0.0-alpha.0
npm WARN node_modules/@mui/x-date-pickers
npm WARN   @mui/x-date-pickers@"5.0.0-alpha.0" from @mui/lab@5.0.0-alpha.77
npm WARN
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^17.0.2" from @mui/x-date-pickers@5.0.0-alpha.0
npm WARN   node_modules/@mui/x-date-pickers
npm WARN     @mui/x-date-pickers@"5.0.0-alpha.0" from @mui/lab@5.0.0-alpha.77
npm WARN     node_modules/@mui/lab

Expected behavior 🤔

Possibly related to #32074. As of now, core MUI is working fine with React 18, the lab should be installed without errors too.

Steps to reproduce 🕹

Steps:

  1. npx create-next-app@latest --typescript
  2. npm install @mui/material @emotion/react @emotion/styled
  3. npm install @mui/lab

Context 🔦

No response

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
System:
    OS: Windows 10 10.0.19044
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.39)
  npmPackages:
    @emotion/react: ^11.9.0 => 11.9.0
    @emotion/styled: ^11.8.1 => 11.8.1
    @mui/base:  5.0.0-alpha.76
    @mui/icons-material: ^5.6.1 => 5.6.1
    @mui/lab: ^5.0.0-alpha.77 => 5.0.0-alpha.77
    @mui/material: ^5.6.1 => 5.6.1
    @mui/private-theming:  5.6.1
    @mui/styled-engine:  5.6.1
    @mui/system:  5.6.1
    @mui/types:  7.1.3
    @mui/utils:  5.6.1
    @mui/x-date-pickers:  5.0.0-alpha.0
    @types/react: 18.0.5 => 18.0.5
    react: ^18.0.0 => 18.0.0
    react-dom: ^18.0.0 => 18.0.0
    typescript: 4.6.3 => 4.6.3

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:7
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
anders-kiaercommented, Apr 30, 2022

I’m seeing the same peer dependency conflict. Looks like @mui/lab has a pinned dependency on @mui/x-date-pickers (which at 5.0.0-alpha.0 is prior to the fixed 5.0.0-alpha.1):

https://github.com/mui/material-ui/blob/f3fefa246b2b17501dae69dcd1b7c8777b75e9a6/packages/mui-lab/package.json#L75

1reaction
austinschradercommented, Jul 6, 2022

@BiancaArtola @mui/styles is not compatible with React 18.

@oliviertassinari

In that case, do you think the MUI documentation should be updated?

The documentation states, “v5 is the only version that fully supports React 18.” But, in the v5 migration documentation, the first step says to run the command: npm install @mui/material @mui/styles. Yet, @mui/styles does not support React 18.

Thank you for your phenomenal and highly complicated work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm ERR! Conflicting peer dependency: react@18.0.0
I have the same issue as yours. To fix the error. Open cli then type: open /Users/Name/.npm then delete folders _cacache, _logs, _npx....
Read more >
What does this error mean? Can't resolve peer dependency ...
ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: netflix@0.1.0 npm ERR! Found: react@18.2.0 npm ERR! node_modules/ ...
Read more >
Installation - Material UI - MUI
Install Material UI, the world's most popular React UI framework. ... Peer dependencies. react >= 17.0.0 and react-dom >= 17.0.0 are peer dependencies....
Read more >
@mui/lab | Yarn - Package Manager
@mui/lab. owner mui3.5mMIT5.0.0-alpha.113TS vulns 0 vulnerabilities. Laboratory for new MUI modules. react, react-component, mui, material-ui ...
Read more >
[Fixed] NPM conflicting peer dependency error
In this post, I will go over a recent error that I was having with peer dependencies and a few ways I approached...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found