【问题标题】:Dependency Issue, React DnD Beautiful [duplicate]依赖问题,React DnD Beautiful [重复]
【发布时间】:2022-01-26 11:15:06
【问题描述】:

我正在尝试安装以下众所周知的软件包。 但是,我对如何诊断此问题感到有些困惑。我想使用这个包,因为它是我网站的核心概念,拖放。

这是说我需要对@16.14.0 做出反应吗?我将如何正确地推动整个项目?这会导致其他软件包出现问题吗?

我对 React 很陌生,特别是树依赖的这个概念?我也知道我的包裹可能搞砸了,如果需要,我很乐意尝试通过提示解决问题。

npm i react-beautiful-dnd

但是我得到了这些错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: new@0.1.0
npm ERR! Found: react@16.8.0
npm ERR! node_modules/react
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.7.0
npm ERR!   node_modules/@emotion/react
npm ERR!     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.6.0   
npm ERR!     node_modules/@emotion/styled
npm ERR!       peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.2.3
npm ERR!       node_modules/@mui/material
npm ERR!         peer @mui/material@"^5.0.0" from @mui/icons-material@5.2.4   
npm ERR!         node_modules/@mui/icons-material
npm ERR!         1 more (the root project)
npm ERR!       3 more (@mui/styled-engine, @mui/system, the root project)   
npm ERR!     peerOptional @emotion/react@"^11.5.0" from @mui/material@5.2.3 
npm ERR!     node_modules/@mui/material
npm ERR!       peer @mui/material@"^5.0.0" from @mui/icons-material@5.2.4   
npm ERR!       node_modules/@mui/icons-material
npm ERR!         @mui/icons-material@"^5.2.4" from the root project
npm ERR!       1 more (the root project)
npm ERR!     3 more (@mui/styled-engine, @mui/system, the root project)     
npm ERR!   peer react@">=16.8.0" from @emotion/styled@11.6.0
npm ERR!   node_modules/@emotion/styled
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.2.3
npm ERR!     node_modules/@mui/material
npm ERR!       peer @mui/material@"^5.0.0" from @mui/icons-material@5.2.4   
npm ERR!       node_modules/@mui/icons-material
npm ERR!         @mui/icons-material@"^5.2.4" from the root project
npm ERR!       1 more (the root project)
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/styled-engine@5.2.0
npm ERR!     node_modules/@mui/styled-engine
npm ERR!       @mui/styled-engine@"^5.2.0" from @mui/system@5.2.3
npm ERR!       node_modules/@mui/system
npm ERR!         @mui/system@"^5.2.3" from @mui/material@5.2.3
npm ERR!         node_modules/@mui/material
npm ERR!     2 more (@mui/system, the root project)
npm ERR!   22 more (@material-ui/core, @material-ui/icons, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-beautiful-dnd@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.5 || ^17.0.0" from react-beautiful-dnd@13.1.0
npm ERR!   node_modules/react-beautiful-dnd
npm ERR!     react-beautiful-dnd@"*" 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.

值得注意的是我的 package.json 看起来:

{
  "name": "new",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.7.0",
    "@emotion/styled": "^11.6.0",
    "@fontsource/roboto": "^4.5.1",
    "@material-ui/icons": "^4.11.2",
    "@mui/icons-material": "^5.2.4",
    "@mui/material": "^5.2.3",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "framer-motion": "^4.1.17",
    "gsap": "^3.9.1",
    "material-ui-search-bar": "^1.0.0",
    "react": "^16.8.0",
    "react-dom": "^16.8.0",
    "react-draggable": "^4.4.4",
    "react-intersection-observer": "^8.33.1",
    "react-scripts": "4.0.3",
    "react-typewriter-effect": "^1.1.0",
    "styled-components": "^5.3.3",
    "typewriter-effect": "^2.18.2",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

这是说我需要对@16.14.0 做出反应吗?我将如何正确地推动整个项目?这会导致其他软件包出现问题吗?

【问题讨论】:

  • 你在package.json中有多个冲突,除了新的:typewriter-effect@mui/material @mui/icons-material。它们似乎都需要 React 17。同时拥有 @material-ui/icons@mui/icons-material 似乎是多余的,因为它们提供了相同的图标集。

标签: node.js reactjs npm


【解决方案1】:

也许您的问题可以通过删除 node_modules 文件夹并运行 npm -g install npm 来解决,就像本教程建议的那样:Unable to install react-beautiful-dnd package

【讨论】:

  • 请不要回答明显的重复 - 一旦你有足够的代表或写一个包含链接的评论,就把 vtc 当作骗子..
  • 我没有评论或 vtc 作为骗子的声誉。
  • 因此我写了 “一旦你有足够的代表” -> 如果你没有 - 继续回答其他问题..
猜你喜欢
  • 2020-06-30
  • 1970-01-01
  • 2019-04-24
  • 2022-11-24
  • 2022-08-24
  • 2021-12-05
  • 2020-05-05
  • 2020-04-04
  • 1970-01-01
相关资源
最近更新 更多