最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - The material ui package refused to install - Stack Overflow

programmeradmin2浏览0评论

C:\Users\User\Desktop\client4>npm i @material-ui/icons

npm ERR! code ERESOLVE

npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR!

npm ERR! While resolving: [email protected]

npm ERR! Found: [email protected]

npm ERR! node_modules/react

npm ERR! react@"^18.2.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/[email protected]

npm ERR! node_modules/@material-ui/core

npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]

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 mand with --force, or --legacy-peer-deps

npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

npm ERR!

npm ERR! See C:\Users\User\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A plete log of this run can be found in:

npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2022-06-21T23_42_51_581Z-debug-0.log

C:\Users\User\Desktop\client4>npm i @material-ui/icons

npm ERR! code ERESOLVE

npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR!

npm ERR! While resolving: [email protected]

npm ERR! Found: [email protected]

npm ERR! node_modules/react

npm ERR! react@"^18.2.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/[email protected]

npm ERR! node_modules/@material-ui/core

npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]

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 mand with --force, or --legacy-peer-deps

npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

npm ERR!

npm ERR! See C:\Users\User\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A plete log of this run can be found in:

npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2022-06-21T23_42_51_581Z-debug-0.log

Share Improve this question edited Jun 22, 2022 at 8:44 torek 491k69 gold badges746 silver badges871 bronze badges asked Jun 21, 2022 at 23:57 Alebiosu Wahab AdewaleAlebiosu Wahab Adewale 371 gold badge2 silver badges7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

The problem is that you are tring to use Material UI v4 with React 18. Try to upgrade to Material UI v5.

npm install @mui/material@latest @emotion/react@latest @emotion/styled@latest
npm install @mui/icons-material@latest

Update

Or if you want to use the v4 (Which i don't recend):

npm install @mui/material @emotion/react @emotion/styled --legacy-peer-deps
npm install @mui/icons-material --legacy-peer-deps
发布评论

评论列表(0)

  1. 暂无评论