首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AG Grid不使用Grid 18安装

AG Grid不使用Grid 18安装
EN

Stack Overflow用户
提问于 2022-04-08 00:49:41
回答 2查看 931关注 0票数 1

我正在尝试运行本教程https://www.ag-grid.com/react-data-grid/getting-started/,当我尝试此npm install --save ag-grid-community ag-grid-react并显示此错误时。

代码语言:javascript
复制
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ag-grid@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0 || ^17.0.0" from ag-grid-react@27.1.0
npm ERR! node_modules/ag-grid-react
npm ERR!   ag-grid-react@"*" from the root project
npm ERR!
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\gusta\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gusta\AppData\Local\npm-cache\_logs\2022-04-08T00_42_18_101Z-debug-0.log
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 ERR! See C:\Users\gusta\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gusta\AppData\Local\npm-cache\_logs\2022-04-08T00_45_54_675Z-debug-0.log

我很困惑,因为文件上说:

代码语言:javascript
复制
React Version   AG Grid Versions
15.x    18 -    21.2.0
16.3+ / 17+     22+ ```

Looks like my only option is to downgrade my REACT Version. 
I am in 18.0.0 . Do you know if I have other options?
EN

回答 2

Stack Overflow用户

发布于 2022-04-08 04:32:49

我用这些设置编辑了package.json,以进行降级以响应17.0.2:

代码语言:javascript
复制
"dependencies": {
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
  },

Run the 
npm install
and 
npm install --save ag-grid-community ag-grid-react
Works with no issues.
票数 0
EN

Stack Overflow用户

发布于 2022-04-09 17:00:04

我还没有看到ag网格显示与React v18兼容。

用纱线代替npm可以避免这样的错误。

yarn install

然后你就会收到警告而不是失败的构建

warning " > ag-grid-react@27.1.0" has incorrect peer dependency "react@^16.3.0 || ^17.0.0".

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71790492

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档