【问题标题】:npm ERESOLVE error when installing Material UI安装 Material UI 时出现 npm ERESOLVE 错误
【发布时间】:2021-11-09 16:30:07
【问题描述】:

尝试安装@material-ui/coregatsby-plugin-material-ui 时出现ERESOLVE 错误:

    npm install @material-ui/core gatsby-plugin-material-ui

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: gatsby-starter-default@0.1.0
npm ERR! Found: gatsby@4.1.2
npm ERR! node_modules/gatsby
npm ERR!   gatsby@"^4.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^3.0.0" from gatsby-plugin-material-ui@4.0.3
npm ERR! node_modules/gatsby-plugin-material-ui
npm ERR!   gatsby-plugin-material-ui@"*" 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


【解决方案1】:

似乎您的依赖关系树已损坏,或者您尝试安装的软件包具有自己的依赖关系,这些依赖关系也被其他对等依赖项使用,但版本不同。

首先,尝试删除所有已安装的包和锁定文件:

rm -rf node_modules && rm package-lock.json

然后您可以尝试使用--legacy-peer-deps 标志重新安装它们:

npm install @material-ui/core gatsby-plugin-material-ui --legacy-peer-deps

【讨论】:

    猜你喜欢
    • 2022-09-27
    • 2015-04-27
    • 1970-01-01
    • 1970-01-01
    • 2018-06-15
    • 1970-01-01
    • 2021-05-26
    • 2015-08-21
    • 2021-03-15
    相关资源
    最近更新 更多