'YARN warning "has unmet peer dependency". What do with this?

Warning in console:

warning "react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning "react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".

This warning appears when I install or remove packages. I don't know what I need to do with this.

Yarn version:

$ yarn -v
1.22.17

Dependencies in package.json:

"dependencies": {
    "axios": "^0.24.0",
    "dotenv": "^10.0.0",
    "mobx": "^6.5.0",
    "mobx-react-lite": "^3.3.0",
    "node-sass": "^7.0.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-dropzone": "^12.0.4",
    "react-hook-form": "^7.29.0",
    "react-id-swiper": "^4.0.0",
    "react-router-dom": "^6.2.1",
    "react-scripts": "5.0.0",
    "react-transition-group": "^4.4.2",
    "swiper": "^7.4.1",
    "web-vitals": "^2.1.2"
  },

"devDependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "@types/dotenv": "^8.2.0",
    "@types/jest": "^27.4.0",
    "@types/node": "^16.11.17",
    "@types/react": "^17.0.38",
    "@types/react-dom": "^17.0.11",
    "prettier": "^2.5.1",
    "typescript": "^4.5.4"
  }

Actually i even removed node_modules and did yarn install, but it didn't help me as you can see.

Also I tried to install this dependencies but it caused new errors which broke my app.



Solution 1:[1]

A peer dependency should be installed by yourself. Usually, the purpose is to prevent version conflicts.

So, when you read a message such as:

warning "react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".

It simply means that the dependency eslint-plugin-flowtype that you are (indirectly) using (through react-scripts) requires that you add @babel/plugin-syntax-flow also as dependency in your package.json.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 flq