【发布时间】:2022-06-13 08:33:38
【问题描述】:
我试图用我的 react 18.0 项目安装材料 ui 核心和图标,但我不能。该项目是使用最新的 create-react-app 创建的
npm install @material-ui/core @material-ui/icons
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR! react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.3
npm ERR! node_modules/@material-ui/core
npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.2
npm ERR! node_modules/@material-ui/icons
npm ERR! @material-ui/icons@"*" 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-cache 文件夹并重新安装它 还是不行
【问题讨论】:
-
当前不支持 React 18,根据错误。
-
试试yarn add,你也安装MUI版本
标签: reactjs material-ui