gpt4 book ai didi

npm - ERESOLVE 无法解析依赖树 - 对于 @mui/material

转载 作者:行者123 更新时间:2023-12-05 00:43:14 24 4
gpt4 key购买 nike

我正在尝试按照主页上的说明安装 ma​​terial UI,但出现依赖关系树错误:

C:\dev\shape-shop-front-end>npm install @mui/material
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@0.1.0
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR! react@"^16.13.1" from the root project
npm ERR! peer react@">=16.8.0" from @emotion/react@11.7.1
npm ERR! node_modules/@emotion/react
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"*" from the root project
npm ERR!

在我的 package.json 我有 "react": "^16.13.1"

据我了解,这个错误是说 MUI 包需要 react 16.8.0

最佳答案

确实,它的一个子依赖项,名为@emotion/react@11.7.1,列出了您必须满足的以下对等依赖项:

"peerDependencies": {
"@babel/core": "^7.0.0",
"react": ">=16.8.0"
}

来源:https://github.com/emotion-js/emotion/blob/main/packages/react/package.json

我认为这与新版本的 NPM 如何处理对等依赖关系有关:https://github.blog/2021-02-02-npm-7-is-now-generally-available/

因为你的 react 版本看起来不错,我会接受这个建议:

You have the option to retry with --force to bypass the conflict or --legacy-peer-deps command to ignore peer dependencies entirely (this behavior is similar to versions 4-6).

关于npm - ERESOLVE 无法解析依赖树 - 对于 @mui/material,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70587214/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com