简体   繁体   English

无法使用 eslint-config-airbnb 解析依赖树

[英]Unable to resolve dependency tree with eslint-config-airbnb

when I'm trying to install eslint-config-airbnb with npx install-peerdeps --dev eslint-config-airbnb I'm getting following error (--legacy-peer-deps flag doesn't help):当我尝试使用 npx npx install-peerdeps --dev eslint-config-airbnb时出现以下错误(--legacy-peer-deps 标志没有帮助):

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: favnote@0.1.0
npm ERR! Found: eslint@7.2.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"7.2.0" from the root project
npm ERR!   peer eslint@"^5.16.0 || ^6.8.0 || ^7.2.0" from eslint-config-airbnb@18.2.1
npm ERR!   node_modules/eslint-config-airbnb
npm ERR!     dev eslint-config-airbnb@"18.2.1" from the root project
npm ERR!   3 more (eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" from eslint-plugin-react-hooks@4.0.0    
npm ERR! node_modules/eslint-plugin-react-hooks
npm ERR!   dev eslint-plugin-react-hooks@"4.0.0" from the root project
npm ERR!   peer eslint-plugin-react-hooks@"^4 || ^3 || ^2.3.0 || ^1.7.0" from eslint-config-airbnb@18.2.1
npm ERR!   node_modules/eslint-config-airbnb
npm ERR!     dev eslint-config-airbnb@"18.2.1" 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! ```

Run npm install --legacy-peer-deps and they will install successfully.运行npm install --legacy-peer-deps ,它们将成功安装。

Looking at your package.json and comparing it to the peer dependencies listed for eslint-config-airbnb , you already have all the peer dependencies in your package.json as dev dependencies.查看您的package.json并将其与为eslint-config-airbnb列出的对等依赖项进行比较,您已经将package.json所有对等依赖项作为开发依赖项。 (They were probably added there when you ran the npx install-peerdeps command but then that command tried to run npm install and failed.) (它们可能是在您运行npx install-peerdeps命令时添加到那里的,但随后该命令尝试运行npm install并失败。)

You can try locking in a specific working Node version by using nvm to roll Node back a few versions.您可以尝试通过使用nvm将 Node 回滚几个版本来锁定特定的工作 Node 版本。

I rolled back from v16.15 to v16.13 and that seemed to fix the issue locally so I locked in that version with node -v >.nvmrc so that my hosting on Netlify/Vercel will use the version I specified.我从v16.15v16.13 ,这似乎在本地解决了这个问题,所以我用node -v >.nvmrc锁定了那个版本,这样我在 Netlify/Vercel 上的托管将使用我指定的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM