[英]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"
}
}
我做了什么:
节点版本:尝试使用 14.15,然后更新到 16.17 NPM:8.11.0
具有像我在 package.json 中的分辨率:屏幕截图
没有分辨率:截图
获得了包含所有前端文件(带有节点模块)的存档并尝试启动(失败),但在其他 windows 机器项目上正确启动(节点 14.15,npm 版本 6)
UPD 新错误:截图
UPD 2:也许从第一个屏幕截图中解决问题更有意义?
如果要解决依赖关系,则必须更改使用的版本。 您的package.json
需要"react": "^18.1.0",
而react-bootstrap-table-next
需要"react": "^16.3.0",
如果要解决冲突,则必须将react-bootstrap-table-next
更新为支持"react": "^18.1.0",
或将package.json
中的 react 依赖项降级为"react": "^16.3.0",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.