使用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依赖:- 先查看eslint-config-airbnb要求的peer依赖:
npm info eslint-config-airbnb peerDependencies - 根据输出的依赖及版本,用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
- 先查看eslint-config-airbnb要求的peer依赖:
内容的提问来源于stack exchange,提问作者grabury
相关产品推荐
相关产品推荐

