reactjs - react-bootstrap-table-next 依赖树问题

标签 reactjs npm react-bootstrap-table

我在安装 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"
  },

最佳答案

经过进一步挖掘该问题似乎与 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 月)节点:当前图像使用的版本。
NPM7 带来的最大变化可能与对等依赖项有关 - 如果可能,NPM 现在应该能够自动安装它们。在这里阅读更多。
如文档中所述,在无法解决冲突的情况下,NPM 现在应该抛出错误而不是警告,这就是您所看到的。
另一方面,我使用您的设置和 NPM v7.0.8 仅设法收到警告而没有错误,我不知道为什么。但是,报告的问题基本上相同,因此解决方案应该非常相似。

关于reactjs - react-bootstrap-table-next 依赖树问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66336966/

相关文章:

javascript - React-JS 通过按下按钮来更改组件的状态

reactjs - 有没有办法告诉 lerna/npm 到 'really look in my own node_modules for those peer dependencies' ?

node.js - 反向地理编码 NPM node.js

javascript - 如何将json数据添加到数组onClick?

javascript - ReactJS AXIOS 帖子不起作用

javascript - FlowTypes 如何从私有(private) npm 模块导入类型

reactjs - React Bootstrap 表(版本 2): Adding Html Buttons

reactjs - React Bootstrap 表中的日期格式

javascript - React Bootstrap Table 无法创建带有映射错误的 TableHeaderColumn。 TableHeaderColumn 中没有定义任何键列

javascript - 根据条件 react 路由器