微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为 ESLint 安装 eslint-config-airbnb 插件时出错

如何解决为 ESLint 安装 eslint-config-airbnb 插件时出错

在基于 redux 的项目的 linter 配置期间,我面临与 Eslint 配置安装相关的问题。

当我运行 npm install --save-dev eslint@7.11.x eslint-config-airbnb@18.1.x eslint-plugin-import@2.22.x eslint-plugin-jsx-a11y@6.2.x eslint-plugin-react@7.20.x eslint-plugin-react-hooks@2.5.x babel-eslint@10.1.x 我收到此错误

Debugger attached.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: react-bookstore-cms@0.1.0
npm ERR! Found: eslint@7.11.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"7.11.x" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^5.16.0 || ^6.8.0" from eslint-config-airbnb@18.1.0
npm ERR! node_modules/eslint-config-airbnb
npm ERR!   dev eslint-config-airbnb@"18.1.x" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict,or retry
npm ERR! this command with --force,or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/dere/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dere/.npm/_logs/2021-03-22T19_38_55_657Z-debug.log
Waiting for the debugger to disconnect...

我使用 create-react-app 脚本创建了项目。 为了解决这个问题,我删除了 package-lock.json 并再次运行 npm install 。它没有解决问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。