簡體   English   中英

無法使用 eslint-config-airbnb 解析依賴樹

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

當我嘗試使用 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! ```

運行npm install --legacy-peer-deps ,它們將成功安裝。

查看您的package.json並將其與為eslint-config-airbnb列出的對等依賴項進行比較,您已經將package.json所有對等依賴項作為開發依賴項。 (它們可能是在您運行npx install-peerdeps命令時添加到那里的,但隨后該命令嘗試運行npm install並失敗。)

您可以嘗試通過使用nvm將 Node 回滾幾個版本來鎖定特定的工作 Node 版本。

我從v16.15v16.13 ,這似乎在本地解決了這個問題,所以我用node -v >.nvmrc鎖定了那個版本,這樣我在 Netlify/Vercel 上的托管將使用我指定的版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM