PS C:UserschandOneDriveDesktopreactamazon-clone> npm install @material-ui/icons
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: amazon-clone@0.1.0
npm ERR! Found: react@18.1.0
npm ERR! node_modules/react
npm ERR! react@"^18.1.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.4
npm ERR! node_modules/@material-ui/core
npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
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 ERR!
npm ERR! See C:UserschandAppDataLocalnpm-cacheeresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UserschandAppDataLocalnpm-cache_logs2022-05-11T20_28_09_686Z-debug-0.log
PS C:UserschandOneDriveDesktopreactamazon-clone>
您已经添加了amazon-clone
作为依赖项,它需要react
的一个版本。您已经添加了react@18.1.0
,但它需要v16或17,如错误信息中指定的。
。
npm install react@17.0.0
他们显然还没有发布对v18的支持,或者它可能在一个开发分支上。
选择一个符合要求的合适版本。