Skip to content

how to solve peer dependency error  #1238

Closed as not planned
Closed as not planned
@byyoungjin

Description

@byyoungjin

Ask your Question

I got this error when I tried to install @testing-library/[email protected]
I got same error when I tried to install latest version. I thought It would be resolved If I choose legacy one( version 9.0.0) but got the same error.

It is my first time thinking about these peer dependencies seriously.
I want to install without --force or --legacy-peer-deps

I cannot understand why it is looking for
peer react@"^18.2.0" from [email protected]
Maybe I'm losing some basic things...

npm install --save-dev @testing-library/[email protected]
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.0.0" from the root project
npm ERR!   peer react@">=16.0.0" from @testing-library/[email protected]
npm ERR!   node_modules/@testing-library/react-native
npm ERR!     dev @testing-library/react-native@"9.0.0" from the root project
npm ERR!   1 more (react-native)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.2.0" from [email protected]
npm ERR! node_modules/react-test-renderer
npm ERR!   dev react-test-renderer@"^18.0.0" from the root project
npm ERR!   peer react-test-renderer@">=16.0.0" from @testing-library/[email protected]
npm ERR!   node_modules/@testing-library/react-native
npm ERR!     dev @testing-library/react-native@"9.0.0" from the root project

here is my dependencies

 "dependencies": {
    "@invertase/react-native-apple-authentication": "^2.2.2",
    "@notifee/react-native": "^7.0.1",
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-firebase/app": "^15.4.0",
    "@react-native-firebase/auth": "^15.4.0",
    "@react-native-firebase/firestore": "^15.4.0",
    "@react-native-firebase/functions": "^15.4.0",
    "@react-native-firebase/messaging": "^15.4.0",
    "@react-native-firebase/storage": "^15.4.0",
    "@react-native-google-signin/google-signin": "^8.0.0",
    "@react-navigation/material-top-tabs": "^6.2.3",
    "@react-navigation/native": "^6.0.12",
    "@react-navigation/native-stack": "^6.8.0",
    "appcenter": "4.4.5",
    "appcenter-analytics": "4.4.5",
    "appcenter-crashes": "4.4.5",
    "babel-plugin-module-resolver": "^4.1.0",
    "date-fns": "^2.29.3",
    "expo": "~46.0.9",
    "expo-image-picker": "^13.3.1",
    "expo-location": "^14.3.0",
    "expo-splash-screen": "~0.16.2",
    "expo-status-bar": "~1.4.0",
    "geodist": "^0.2.1",
    "geofirestore": "^5.2.0",
    "immer": "^9.0.15",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-native": "0.69.5",
    "react-native-fast-image": "^8.6.1",
    "react-native-gesture-handler": "^2.6.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-gifted-chat": "^1.0.4",
    "react-native-maps": "^1.3.0",
    "react-native-pager-view": "^6.0.0",
    "react-native-purchases": "^5.1.0",
    "react-native-restart": "^0.0.24",
    "react-native-safe-area-context": "^4.3.3",
    "react-native-screens": "^3.17.0",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-super-grid": "^4.6.1",
    "react-native-svg": "^13.0.0",
    "react-native-tab-view": "^3.1.1",
    "react-native-web": "~0.18.7",
    "uuid": "^8.3.2",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/jest": "^29.2.3",
    "@types/react": "~18.0.0",
    "@types/react-native": "~0.69.1",
    "@typescript-eslint/eslint-plugin": "^5.44.0",
    "@typescript-eslint/parser": "^5.44.0",
    "eslint": "^8.28.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.31.11",
    "husky": "^8.0.0",
    "jest": "^29.3.1",
    "lint-staged": "^13.0.3",
    "prettier": "^2.7.1",
    "react-native-svg-transformer": "^1.0.0",
    "react-native-version": "^4.0.0",
    "react-test-renderer": "^18.0.0",
    "typescript": "^4.6.3"
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions