材料UI,下一步12,反应18



我正在尝试最新版本的NextJS(版本12(,以使我的项目能够访问SSR ServerComponents&Http流。

MaterialUI适用于Next 12.0.7和React 17(使用npx安装create-next-app@latest)

当我做时

npm install react@beta react-dom@beta

然后

npm install @mui/material @mui/styled-engine-sc styled-components --save

提供

(base) marcfielding@MBP meta-ui % npm install @mui/material @mui/styled-engine-sc styled-components --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: meta-ui@undefined
npm ERR! Found: react@18.0.0-rc.0-next-f2a59df48-20211208
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0-beta-24dd07bd2-20211208" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.2" from @mui/material@5.2.3
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! See /Users/marcfielding/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/marcfielding/.npm/_logs/2021-12-09T16_48_20_688Z-debug.log

这只是等待MUI赶上吗?或者有没有我可以按照之前的说明安装的版本?

如果你不介意使用yarn,这里有一个repo,你可以用你想要的dep分叉:https://github.com/MiniDeathStar/material-ui-next12-react-18

如果你想使用npm,你可以运行:

npm install @mui/material @mui/styled-engine-sc styled-components --legacy-peer-deps

梅不应该被打断React@18.我把它们放在一起用得很好。Npm是一个挑剔的软件包经理,所以只要有机会,我就会支持Yarn 3。

最新更新