ERESOLVE 无法解析依赖关系树 - 对于 @mui/material
ERESOLVE unable to resolve dependency tree - for @mui/material
我正尝试按照主页上的说明安装 material 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).
看来更新 package.json 中的依赖项是现在实现此目标的唯一方法。
$ npm install -g npm-check-updates
$ ncu -u
$ npm install
或参见how to update each dependency in package.json
更新后,现在尝试安装您的 material UI。
尝试使用 --force。
这对我有用
npm install @mui/material --force
我感觉这是最近 React 升级带来的依赖冲突...
我正尝试按照主页上的说明安装 material 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).
看来更新 package.json 中的依赖项是现在实现此目标的唯一方法。
$ npm install -g npm-check-updates
$ ncu -u
$ npm install
或参见how to update each dependency in package.json
更新后,现在尝试安装您的 material UI。
尝试使用 --force。 这对我有用
npm install @mui/material --force
我感觉这是最近 React 升级带来的依赖冲突...