material-ui: @mui/lab has a peer dependency conflict with React 18
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:
- npx create-next-app@latest --typescript
- npm install @mui/material @emotion/react @emotion/styled
- 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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 17 (6 by maintainers)
Team if you can help on the below error , I am getting the error message in Pipeline only . but when I am running this code it is working in the local machine. I am updating my my application with latest.
npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @mui/styles@5.11.2 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! react@β^18.2.0β from the root project npm ERR! peer react@β>=16.8.0β from @emotion/react@11.10.5 npm ERR! node_modules/@emotion/react npm ERR! @emotion/react@β^11.10.5β from the root project npm ERR! peer @emotion/react@β^11.0.0-rc.0β from @emotion/styled@11.10.5 npm ERR! node_modules/@emotion/styled npm ERR! @emotion/styled@β^11.10.5β from the root project npm ERR! 4 more (@mui/material, @mui/styled-engine, @mui/system, @mui/x-date-pickers) npm ERR! 4 more (@mui/material, @mui/styled-engine, @mui/system, @mui/x-date-pickers) npm ERR! 36 more (@emotion/styled, β¦) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@β^17.0.0β from @mui/styles@5.11.2 npm ERR! node_modules/@mui/styles npm ERR! @mui/styles@β^5.11.2β from the root project npm ERR! npm ERR! Conflicting peer dependency: react@17.0.2 npm ERR! node_modules/react npm ERR! peer react@β^17.0.0β from @mui/styles@5.11.2 npm ERR! node_modules/@mui/styles npm ERR! @mui/styles@β^5.11.2β 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! See C:\Windows\ServiceProfiles\NetworkService\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Windows\ServiceProfiles\NetworkService\AppData\Local\npm-cache_logs\2023-01-13T11_24_24_174Z-debug-0.log 2023-01-13T11:24:27.0813090Z ##[warning]Couldnβt find a debug log in the cache or working directory 2023-01-13T11:24:27.1433772Z ##[error]Error: Npm failed with return code: 1 2023-01-13T11:24:27.1748242Z ##[section]Finishing: npm install
@Shahzad6077 I doubt they will work on making it compatible.
@mui/stylesis deprecated. Find time to migrate.Source: https://mui.com/system/styles/basics/. Itβs also discussed in #32142.
Iβm seeing the same peer dependency conflict. Looks like
@mui/labhas a pinned dependency on@mui/x-date-pickers(which at5.0.0-alpha.0is prior to the fixed5.0.0-alpha.1):https://github.com/mui/material-ui/blob/f3fefa246b2b17501dae69dcd1b7c8777b75e9a6/packages/mui-lab/package.json#L75
@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/stylesdoes not support React 18.Thank you for your phenomenal and highly complicated work.
@oliviertassinari is there a specific version this error does not come up in. I just did
npm install @mui/lab@latestand this error still shows up.Same answer as the first one. See the latest release, there are new versions of the packages.