8

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.

0

1 Answer 1

13

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.

1
  • Most people are likely using npm's auto-install for peer dependencies at this point (V7 and above). If anyone needs it, the reason the auto installation can fail sometimes (from npm) is because "npm 7 will block installations if an upstream dependency conflict is present that cannot be automatically resolved." @Stephane's solution is still correct, but that's ^ the reason why things may unexpectedly fail in newer npm versions Ref: stackoverflow.com/questions/69568419/…
    – Kyle
    Commented Jun 18, 2023 at 13:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.