【问题标题】:npm ERR! code ERESOLVE unable to resolve dependency treenpm 错误!代码 ERESOLVE 无法解析依赖树
【发布时间】:2021-06-16 06:22:35
【问题描述】:

我从使用克隆它的 repo 中获得了这个项目

git 克隆

然后 cd 进入正确的目录

Example

接下来我去安装项目,出现这个错误

enter image description here

这是 JSON 文件

{
  "name": "tryb-prints",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "atomize": "^1.0.26",
    "bootstrap": "^4.5.3",
    "firebase": "^8.0.2",
    "materialize-css": "^1.0.0-rc.2",
    "react": "^17.0.1",
    "react-bootstrap": "^1.4.0",
    "react-dom": "^17.0.1",
    "react-router-bootstrap": "^0.25.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.4",
    "react-transition-group": "^4.4.1",
    "semantic-ui-css": "^2.4.1",
    "semantic-ui-react": "^2.0.1",
    "shopify-buy": "^2.11.0",
    "styletron-engine-atomic": "^1.4.6",
    "styletron-react": "^5.2.7"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

任何帮助都会得到帮助

【问题讨论】:

    标签: reactjs npm npm-install npm-start


    【解决方案1】:

    因为你的一些内在依赖迫使反应 ^16.8 你不能使用版本 17+。

    降级到主要版本 17 以下,一切顺利

    【讨论】:

    • 我只需要降级react版本或更改json文件
    • 嘿凯瑟尔。这取决于。我只想在包 json 中更改它(删除 ^ 一秒钟),安装并将 ^ 放回原处。那应该是最安全快捷的
    【解决方案2】:

    尝试使用 npm install --legacy-peer-deps

    【讨论】:

    • 这适用于我的情况,我们都在使用 npm 6.x,有人用 7.x 试试运气。
    • 非常感谢它对我的帮助很大。
    猜你喜欢
    • 2022-10-07
    • 2022-06-23
    • 1970-01-01
    • 1970-01-01
    • 2022-01-25
    • 2021-03-24
    • 2021-08-04
    • 2022-01-08
    • 2021-09-25
    相关资源
    最近更新 更多