我目前正在使用 Angular 13、Ionic CLI 和 Angular Material 創建一個專案。@angular/material當我不使用 Ionic 時添加沒有問題,但使用 Ionic 時出現以下錯誤:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: SalesResume@0.0.1
npm ERR! Found: @angular/core@13.2.7
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"~13.2.2" from the root project
npm ERR! peer @angular/core@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.7
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.8" from @angular/animations@13.3.8
npm ERR! node_modules/@angular/animations
npm ERR! peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/material@13.3.7
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"*" 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/**********/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! ------------------------------------------------
我認為這意味著我的 NPM 已損壞。我已經嘗試卸載并重新安裝 node.js 并沒有解決它。我試過清除我的 npm 快取。我在其他 stackOverflow 問題上看到的答案也提到嘗試使用--legacy-peer-deps,這對我也不起作用。
我正在使用 npm:'8.10.0',角度 CLI:'13.2.6',和 ionic:'6.19.1'
在我看來,這是一個相當深奧的錯誤,因為我在網上沒有找到任何答案。
先感謝您!!
uj5u.com熱心網友回復:
從您的螢屏截圖中可以看出,您在專案 v13.3.8 中有 @angular/animations。第二部分通知您,它具有 @angular/core v13.3.8 的對等依賴項。截至目前的最新包。
從第一部分來看,您似乎擁有@angular/core v13.2.7。
如果是這種情況,我建議檢查您的 package.json 檔案。運行“ng update”以查找可以更新的軟體包,然后運行“ng update package-1 package-2 etc”。想象一下這些包會像@angular/core 和@angular/cli。
鏈接到 ng 更新檔案: https ://angular.io/cli/update
抱歉,如果這不起作用。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/474699.html
