简体   繁体   中英

How to resolve dependencies npm conflict?

package.json

{
  "name": "reactjs",
  "version": "4.7.1",
  "private": true,
  "dependencies": {
    "@ant-design/icons": "^4.2.2",
    "@aspnet/signalr": "^1.1.4",
    "@craco/craco": "^5.6.2",
    "@fullcalendar/bootstrap": "^5.9.0",
    "@fullcalendar/core": "4.4.0",
    "@fullcalendar/daygrid": "^5.9.0",
    "@fullcalendar/interaction": "^5.9.0",
    "@fullcalendar/react": "^5.9.0",
    "@fullcalendar/timegrid": "4.4.2",
    "@types/d3-scale": "^4.0.2",
    "@types/react-bootstrap-table-next": "^4.0.18",
    "abp-web-resources": "^5.1.1",
    "antd": "^4.6.4",
    "apexcharts": "^3.35.2",
    "axios": "^0.19.0",
    "bootstrap": "^5.1.0",
    "classnames": "^2.2.6",
    "craco-antd": "^1.14.1",
    "d3-scale": "^4.0.2",
    "echarts": "^5.3.2",
    "echarts-for-react": "^3.0.2",
    "env-cmd": "^10.1.0",
    "famfamfam-flags": "^1.0.0",
    "formik": "^2.2.9",
    "highcharts": "^10.2.0",
    "highcharts-react-official": "^3.1.0",
    "lodash": "^4.17.15",
    "mobx": "^6.5.0",
    "mobx-react": "^7.4.0",
    "mobx-react-lite": "^3.4.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.27",
    "query-string": "^6.9.0",
    "rc-slider": "^8.7.1",
    "rc-tooltip": "^4.0.0-alpha.3",
    "react": "^18.1.0",
    "react-apexcharts": "^1.4.0",
    "react-bootstrap": "^2.0.0-beta.6",
    "react-bootstrap-table-next": "^3.3.5",
    "react-bootstrap-table2-editor": "^1.4.0",
    "react-bootstrap-table2-paginator": "^2.1.1",
    "react-bootstrap-table2-toolkit": "^2.1.1",
    "react-datepicker": "^2.11.0",
    "react-datetime": "^2.16.3",
    "react-document-title": "^2.0.3",
    "react-dom": "^18.1.0",
    "react-image-crop": "^9.0.3",
    "react-loadable": "^5.5.0",
    "react-notifications": "^1.4.3",
    "react-perfect-scrollbar": "^1.5.3",
    "react-quill": "^1.3.3",
    "react-router-dom": "^5.1.2",
    "react-scripts": "^3.2.0",
    "react-select": "^5.3.2",
    "react-vis": "^1.11.7",
    "recharts": "^1.8.5",
    "sass": "^1.51.0",
    "sweetalert2": "^9.5.4",
    "sweetalert2-react": "^0.8.3",
    "yup": "^0.32.11"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "scripts": {
    "start": "env-cmd -f .env.dev craco start",
    "start-local": "env-cmd -f .env.local craco start",
    "start-production": "env-cmd -f .env.production craco start",
    "build": "env-cmd -f .env.dev craco build",
    "build-local": "env-cmd -f .env.local craco build",
    "build-production": "env-cmd -f .env.production craco build",
    "lint": "eslint . --ext .ts,.tsx",
    "test": "craco test",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "@types/classnames": "^2.2.9",
    "@types/jest": "^24.0.23",
    "@types/moment": "^2.13.0",
    "@types/moment-timezone": "^0.5.12",
    "@types/node": "^12.12.14",
    "@types/react": "^16.9.13",
    "@types/react-datepicker": "^4.4.1",
    "@types/react-document-title": "^2.0.3",
    "@types/react-dom": "^16.9.4",
    "@types/react-loadable": "^5.5.2",
    "@types/react-router-dom": "^5.1.3",
    "@types/react-vis": "^1.11.11",
    "@types/recharts": "^1.8.3",
    "@typescript-eslint/eslint-plugin": "^4.0.1",
    "@typescript-eslint/parser": "^4.0.1",
    "copy-webpack-plugin": "^5.0.5",
    "eslint": "^6.8.0",
    "eslint-config-airbnb-typescript": "^9.0.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jest": "^23.17.1",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.20.6",
    "eslint-plugin-react-hooks": "^4.1.0",
    "prettier": "^2.0.5",
    "ts-import-plugin": "^1.6.1",
    "typescript": "^3.7.2"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "resolutions": {
    "@types/react": "16.3.0"
  }
}

What I've done:

  • yarn - install correctly but finally I had: screenshot
  • npm ci
  • npm i
  • npm i --force and npm i --legacy-peer-deps(both install modules, but finally I had an error)
  • tried to add resolutions to package.json
  • deleted package-lock, yarn.lock and node_modules and after npm i or yarn
  • tried different versions of react in resolution package

Node version: tried with 14.15 and then updated to 16.17 NPM: 8.11.0

with resolutions like I have in package.json: screenshot

without resolutions: screenshot

Got a archive with all fronted files(with node modules) and tried to start(failed), but on other windows machine project started correctly(Node 14.15, npm version 6)

UPD new error: screenshot

UPD 2: maybe it makes more sense to resolve the issues from the first screen shot?

If you want to resolve your dependencies you will have to change the used versions. your package.json requires "react": "^18.1.0", while react-bootstrap-table-next requires "react": "^16.3.0", .

If you want to resolve your conflict you will have to update react-bootstrap-table-next to a version which supports "react": "^18.1.0", or downgrade your react dependency in the package.json to "react": "^16.3.0",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM