最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Could not resolve dependency: peer react-dnd@"^7.3.0" when upgrading node.js from v12.13.1 to v22.13.1 - Stack

programmeradmin2浏览0评论

Due to vulnerabilities, I was asked to upgrade node.js from v12.13.1 to v22.13.1 in a legacy system.

When I ran npm install, following errors are shown.

[ERROR] npm warn ERESOLVE overriding peer dependency
[ERROR] npm warn While resolving: [email protected]
[ERROR] npm warn Found: [email protected]
[ERROR] npm warn node_modules/react-sortable-tree/node_modules/react-dnd
[ERROR] npm warn react-dnd@"^11.1.3" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree
[ERROR] npm warn react-sortable-tree@"^2.7.1" from [email protected]
[ERROR] npm warn node_modules/mui-datatables
[ERROR] npm warn
[ERROR] npm warn Could not resolve dependency:
[ERROR] npm warn peer react-dnd@"^7.3.0" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree/node_modules/frontend-collective-react-dnd-scrollzone
[ERROR] npm warn frontend-collective-react-dnd-scrollzone@"^1.0.2" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree
[ERROR] npm warn
[ERROR] npm warn Conflicting peer dependency: [email protected]
[ERROR] npm warn node_modules/react-dnd
[ERROR] npm warn peer react-dnd@"^7.3.0" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree/node_modules/frontend-collective-react-dnd-scrollzone
[ERROR] npm warn frontend-collective-react-dnd-scrollzone@"^1.0.2" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree

Contents of package.json are shown below.

{
  "name": "abc",
  "version": "0.0.1",
  "description": "System",
  "main": "index.js",
  "scripts": {
    "webpack-svr": "webpack-dev-server",
    "webpack-watch": "webpack --watch"
  },
  "keywords": [
    "rest",
    "security",
    "material-ui",
    "spring",
    "data",
    "react"
  ],
  "author": "abc",
  "license": "UNLICENSED",
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.10.2",
    "@babel/preset-env": "^7.10.2",
    "@babel/preset-react": "^7.10.1",
    "@babel/preset-typescript": "^7.10.1",
    "babel-loader": "^8.1.0",
    "css-loader": "^7.1.2",
    "file-loader": "^6.2.0",
    "mini-css-extract-plugin": "^2.9.2",
    "sass": "^1.84.0",
    "sass-loader": "^16.0.4",
    "style-loader": "^0.23.1",
    "url-loader": "^4.1.1",
    "webpack": "^5.97.1",
    "webpack-cli": "^6.0.1",
    "webpack-dev-server": "^5.2.0"
  },
  "dependencies": {
    "@date-io/moment": "^1.3.13",
    "@material-ui/core": "^4.11.0",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/pickers": "^3.2.10",
    "@types/react": "^16.9.36",
    "@types/react-dom": "^16.9.8",
    "axios": "^0.19.2",
    "babel-plugin-react-css-modules": "^5.2.6",
    "classnames": "^2.2.6",
    "clsx": "^1.1.0",
    "immutability-helper": "^3.1.1",
    "moment": "^2.25.3",
    "mui-datatables": "^3.4.1",
    "notistack": "^0.9.17",
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-app-polyfill": "^1.0.6",
    "react-cookie": "^4.0.3",
    "react-dom": "^16.13.1",
    "react-material-ui-form-validator": "^2.0.10",
    "react-number-format": "^4.4.1",
    "react-redux": "^6.0.1",
    "react-router-dom": "^5.2.0",
    "react-transition-group": "^2.9.0",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"
  }
}

I've tried to upgrade mui-datatables from v3.4.1 to the latest v4.3.0 but the version of React has to be upgraded too. Since it's a legacy system, I don't want to upgrade the react version at the moment. I've spent a few days googling but can't find a solution. Would someone please help?

Due to vulnerabilities, I was asked to upgrade node.js from v12.13.1 to v22.13.1 in a legacy system.

https://nodejs.org/en/blog/vulnerability/january-2025-security-releases

When I ran npm install, following errors are shown.

[ERROR] npm warn ERESOLVE overriding peer dependency
[ERROR] npm warn While resolving: [email protected]
[ERROR] npm warn Found: [email protected]
[ERROR] npm warn node_modules/react-sortable-tree/node_modules/react-dnd
[ERROR] npm warn react-dnd@"^11.1.3" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree
[ERROR] npm warn react-sortable-tree@"^2.7.1" from [email protected]
[ERROR] npm warn node_modules/mui-datatables
[ERROR] npm warn
[ERROR] npm warn Could not resolve dependency:
[ERROR] npm warn peer react-dnd@"^7.3.0" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree/node_modules/frontend-collective-react-dnd-scrollzone
[ERROR] npm warn frontend-collective-react-dnd-scrollzone@"^1.0.2" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree
[ERROR] npm warn
[ERROR] npm warn Conflicting peer dependency: [email protected]
[ERROR] npm warn node_modules/react-dnd
[ERROR] npm warn peer react-dnd@"^7.3.0" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree/node_modules/frontend-collective-react-dnd-scrollzone
[ERROR] npm warn frontend-collective-react-dnd-scrollzone@"^1.0.2" from [email protected]
[ERROR] npm warn node_modules/react-sortable-tree

Contents of package.json are shown below.

{
  "name": "abc",
  "version": "0.0.1",
  "description": "System",
  "main": "index.js",
  "scripts": {
    "webpack-svr": "webpack-dev-server",
    "webpack-watch": "webpack --watch"
  },
  "keywords": [
    "rest",
    "security",
    "material-ui",
    "spring",
    "data",
    "react"
  ],
  "author": "abc",
  "license": "UNLICENSED",
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.10.2",
    "@babel/preset-env": "^7.10.2",
    "@babel/preset-react": "^7.10.1",
    "@babel/preset-typescript": "^7.10.1",
    "babel-loader": "^8.1.0",
    "css-loader": "^7.1.2",
    "file-loader": "^6.2.0",
    "mini-css-extract-plugin": "^2.9.2",
    "sass": "^1.84.0",
    "sass-loader": "^16.0.4",
    "style-loader": "^0.23.1",
    "url-loader": "^4.1.1",
    "webpack": "^5.97.1",
    "webpack-cli": "^6.0.1",
    "webpack-dev-server": "^5.2.0"
  },
  "dependencies": {
    "@date-io/moment": "^1.3.13",
    "@material-ui/core": "^4.11.0",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/pickers": "^3.2.10",
    "@types/react": "^16.9.36",
    "@types/react-dom": "^16.9.8",
    "axios": "^0.19.2",
    "babel-plugin-react-css-modules": "^5.2.6",
    "classnames": "^2.2.6",
    "clsx": "^1.1.0",
    "immutability-helper": "^3.1.1",
    "moment": "^2.25.3",
    "mui-datatables": "^3.4.1",
    "notistack": "^0.9.17",
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-app-polyfill": "^1.0.6",
    "react-cookie": "^4.0.3",
    "react-dom": "^16.13.1",
    "react-material-ui-form-validator": "^2.0.10",
    "react-number-format": "^4.4.1",
    "react-redux": "^6.0.1",
    "react-router-dom": "^5.2.0",
    "react-transition-group": "^2.9.0",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"
  }
}

I've tried to upgrade mui-datatables from v3.4.1 to the latest v4.3.0 but the version of React has to be upgraded too. Since it's a legacy system, I don't want to upgrade the react version at the moment. I've spent a few days googling but can't find a solution. Would someone please help?

Share Improve this question edited 3 hours ago VLAZ 29k9 gold badges62 silver badges83 bronze badges asked 3 hours ago 190303458190303458 639 bronze badges 1
  • 1 The error was truncated. You can just use --legacy-peer-deps flag as it suggests. If node is used only for this project, it's unlikely it's affected by the vulnerability – Estus Flask Commented 2 hours ago
Add a comment  | 

1 Answer 1

Reset to default 0

Use this one

npm install [email protected] [email protected] --legacy-peer-deps

and then this

npm install --legacy-peer-deps

if didn't help this

rm -rf node_modules package-lock.json
npm cache clean --force
npm install --legacy-peer-deps

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论