【问题标题】:react-bootstrap-table-next dependency tree issuereact-bootstrap-table-next 依赖树问题
【发布时间】:2021-02-23 16:19:35
【问题描述】:

我在安装 npm install react-bootstrap-table-next --save 时收到错误消息。

我不明白它告诉我什么或如何解决,感谢任何指导:

错误:

$ npm install react-bootstrap-table-next --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: frontend@0.1.0
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0" from react-bootstrap-table-next@4.0.3
npm ERR! node_modules/react-bootstrap-table-next
npm ERR!   react-bootstrap-table-next@"*" 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.

我的依赖:

  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.3",
    "@testing-library/user-event": "^12.6.0",
    "axios": "^0.21.1",
    "bootstrap": "^4.6.0",
    "react": "^17.0.1",
    "react-bootstrap": "^1.4.3",
    "react-dom": "^17.0.1",
    "react-paypal-button-v2": "^2.6.2",
    "react-redux": "^7.2.2",
    "react-router-bootstrap": "^0.25.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "redux-thunk": "^2.3.0",
    "web-vitals": "^0.2.4"
  },

【问题讨论】:

    标签: reactjs npm react-bootstrap-table


    【解决方案1】:

    经过进一步挖掘,问题似乎与 NPM v7 相关,运行以下命令解决了该问题:

    npm install react-bootstrap-table-next --save --legacy-peer-deps

    关键信息如下所示,取自以下帖子:

    unable-to-resolve-dependency-tree-reactjs

    graphql-eresolve-unable-to-resolve-dependency

    NPM v7

    最近发布了 NPM v7,这是当前(截至 2020 年 11 月)node:current images 使用的版本。

    NPM7 带来的最大变化可能与对等依赖关系有关——如果可能的话,NPM 现在应该能够自动安装它们。在这里阅读更多。

    如文档中所述,在无法解决冲突的情况下,NPM 现在应该抛出错误而不是警告,这就是您所看到的。

    另一方面,我使用您的设置和 NPM v7.0.8 只设法得到警告并且没有错误,我不知道为什么。但是,报告的问题基本相同,因此解决方案应该非常相似。

    【讨论】:

      【解决方案2】:

      我在我的项目中遇到了同样的问题,我试试这个..

      访问https://github.com/react-bootstrap-table/react-bootstrap-table2/issues/989

      npm install @types/react-bootstrap-table-next

      【讨论】:

      • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
      【解决方案3】:

      我今天在 Mac 上遇到了同样的错误。我只是通过安装最新版本的 NodeJs 来解决它。我建议您尝试更新“nodeJs”安装。

      【讨论】:

        猜你喜欢
        • 2022-09-29
        • 2020-11-16
        • 1970-01-01
        • 2018-02-10
        • 2022-01-19
        • 2021-12-05
        • 1970-01-01
        • 2022-01-25
        • 2021-06-28
        相关资源
        最近更新 更多