You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何消除yarn install时出现的‘unmet peer dependency’警告?

解决yarn install时的未满足peer依赖警告

你执行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".
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 " > eslint-config-airbnb@19.0.4" has unmet peer dependency "eslint-plugin-import@^2.25.3".
warning " > eslint-config-airbnb@19.0.4" has unmet peer dependency "eslint-plugin-react-hooks@^4.3.0".
warning "eslint-config-airbnb > eslint-config-airbnb-base@15.0.0" has unmet peer dependency "eslint-plugin-import@^2.25.2".warning " > eslint-config-airbnb-typescript@17.0.0" has unmet peer dependency "eslint-plugin-import@^2.25.3".
warning "stylelint-config-standard-scss > stylelint-config-recommended-scss > postcss-scss@4.0.5" has unmet peer dependency "postcss@^8.3.3".

解决步骤

  • 直接安装所有缺失的peer依赖(作为开发依赖):
    在项目根目录执行以下命令:

    yarn add -D @babel/plugin-syntax-flow@^7.14.5 @babel/plugin-transform-react-jsx@^7.14.9 eslint-plugin-import@^2.25.3 eslint-plugin-react-hooks@^4.3.0 postcss@^8.3.3
    

    这条命令会一次性安装所有警告中提到的缺失依赖,版本完全匹配警告要求,执行后再运行yarn install就不会出现这些警告了。

  • 补充说明:这类peer依赖警告不会导致项目无法运行,只是提示某些依赖包需要特定版本的配套包来保证功能完整,安装后能消除提示并确保相关工具(如ESLint、Stylelint)正常工作。

内容的提问来源于stack exchange,提问作者Kiran D Patkar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 08:35:24