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

使用Yarn执行install-peerdeps为何出现undefined错误?

解决install-peerdeps安装eslint-config-airbnb时出现ERR undefined的问题

问题场景

执行命令npx install-peerdeps --dev eslint-config-airbnb,选择使用Yarn安装后报错:

install-peerdeps v3.0.3
检测到您正在使用Yarn,是否使用Yarn进行安装?(y/n) y
ERR undefined

可行解决方案

  • 直接指定Yarn执行,跳过交互询问
    运行以下命令,无需手动选择,直接用Yarn处理peer依赖:

    npx install-peerdeps --dev eslint-config-airbnb --yarn
    
  • 更新install-peerdeps到最新版本
    旧版本工具可能存在兼容性bug,先更新全局的install-peerdeps:

    npm install -g install-peerdeps
    

    更新完成后再重新执行原安装命令。

  • 手动安装peer依赖
    如果工具仍有问题,直接查询并手动安装所需的peer依赖:

    1. 先查看eslint-config-airbnb要求的peer依赖:
      npm info eslint-config-airbnb peerDependencies
      
    2. 根据输出的依赖及版本,用Yarn安装,示例命令(版本号需替换为实际查询结果):
      yarn add --dev eslint@^8.0.0 eslint-plugin-import@^2.25.0 eslint-plugin-react@^7.28.0 eslint-plugin-react-hooks@^4.3.0 eslint-plugin-jsx-a11y@^6.5.0
      

内容的提问来源于stack exchange,提问作者grabury

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 00:04:53