Skip to content

bug: Cannot update react-router / react-router-dom past to 6.x.x #29620

@DunhamGitHub

Description

@DunhamGitHub

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

npm install gives an error when using version 6 of react-router(-dom). No error with any version 5.

sil@SIL-IMAC-CH mxmobile % npm install            
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: mxmobile@2.0.3
npm ERR! Found: react-router@6.23.1
npm ERR! node_modules/react-router
npm ERR!   react-router@"^6.23.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-router@"^5.0.1" from @ionic/react-router@8.2.2
npm ERR! node_modules/@ionic/react-router
npm ERR!   @ionic/react-router@"^8.1.1" 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.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/sil/.npm/_logs/2024-06-13T13_56_52_214Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/sil/.npm/_logs/2024-06-13T13_56_52_214Z-debug-0.log
sil@SIL-IMAC-CH mxmobile % 

Expected Behavior

Dependency should not require version 5.

Steps to Reproduce

  • make vanilla project
  • use below package.json content
  • run npm install
{
  "name": "test",
  "version": "0.0.1",
  "private": true,
  "type": "module",
  "_checkLatestVersionHere": "https://www.npmjs.com/package/@types/node",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview",
    "test.e2e": "cypress run",
    "test.unit": "vitest",
    "lint": "eslint"
  },
  "dependencies": {
    "@amcharts/amcharts4": "^4.10.22",
    "@capacitor-community/file-opener": "^6.0.0",
    "@capacitor/android": "6.0.0",
    "@capacitor/app": "6.0.0",
    "@capacitor/core": "6.0.0",
    "@capacitor/dialog": "6.0.0",
    "@capacitor/filesystem": "6.0.0",
    "@capacitor/haptics": "6.0.0",
    "@capacitor/ios": "6.0.0",
    "@capacitor/keyboard": "6.0.0",
    "@capacitor/status-bar": "6.0.0",
    "@ionic/react": "^8.1.1",
    "@ionic/react-router": "^8.1.1",
    "@types/react-router": "^5.1.20",
    "@types/react-router-dom": "^5.3.3",
    "i18next": "^23.10.1",
    "i18next-browser-languagedetector": "^7.2.1",
    "ionicons": "^7.4.0",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-i18next": "^14.1.0",
    "react-intl": "^6.2.2",
    "react-router": "^6.23.1",
    "react-router-dom": "^6.23.1"
  },
  "devDependencies": {
    "@capacitor/cli": "6.0.0",
    "@testing-library/dom": ">=7.21.4",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^14.0.0",
    "@testing-library/user-event": "^14.4.3",
    "@types/react": "^18.0.27",
    "@types/react-dom": "^18.0.10",
    "@vitejs/plugin-legacy": "^5.0.0",
    "@vitejs/plugin-react": "^4.0.1",
    "cypress": "^13.5.0",
    "eslint": "^8.35.0",
    "eslint-plugin-react": "^7.32.2",
    "jsdom": "^24.0.0",
    "terser": "^5.4.0",
    "typescript": "^5.1.6",
    "vite": "^5.2.11",
    "vitest": "^0.34.6"
  },
  "description": "An Ionic project"
}

When changing

    "react-router": "^6.23.1",
    "react-router-dom": "^6.23.1"

to

    "react-router": "^5.3.4",
    "react-router-dom": "^5.3.4"

= no error

Code Reproduction URL

.......

Ionic Info


Ionic:

   Ionic CLI       : 7.2.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework : not installed

Capacitor:

   Capacitor CLI      : not installed
   @capacitor/android : not installed
   @capacitor/core    : not installed
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : not installed globally

System:

   NodeJS : v20.13.1 (/usr/local/Cellar/node@20/20.13.1/bin/node)
   npm    : 10.5.2
   OS     : macOS Unknown

Additional Information

No response

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions