纱线警告 "has unmet peer dependency"。用这个做什么?

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

控制台警告:

warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".

当我安装或删除软件包时出现此警告。我不知道我需要用这个做什么。

纱线版本:

$ yarn -v
1.22.17

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"
  }

实际上我什至删除了 node_modules 并删除了 yarn install,但如您所见,它对我没有帮助。

我也尝试安装这个依赖项,但它导致了新的错误,导致我的应用程序崩溃。

对等依赖需要自己安装。通常,目的是防止版本冲突。

因此,当您阅读以下消息时:

warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".

这只是意味着您正在(通过 react-scripts)(间接)使用的依赖项 eslint-plugin-flowtype 需要您在 package.json 中添加 @babel/plugin-syntax-flow 作为依赖项.