[英]Problem installing material package for Angular
安裝角度材料包時出現錯誤。 我不明白這個錯誤。 有人可以幫忙嗎?
我得到的輸出如下所示:
npm install @angular/material @angular/cdk @angular/animations --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: scheduler@0.0.0
npm ERR! Found: @angular/animations@15.0.1
npm ERR! node_modules/@angular/animations
npm ERR! peerOptional @angular/animations@"15.0.1" from @angular/platform-browser@15.0.1
npm ERR! node_modules/@angular/platform-browser
npm ERR! peer @angular/platform-browser@"15.0.1" from @angular/forms@15.0.1
npm ERR! node_modules/@angular/forms
npm ERR! @angular/forms@"^15.0.1" from the root project
npm ERR! peer @angular/platform-browser@"15.0.1" from @angular/platform-browser-dynamic@15.0.1
npm ERR! node_modules/@angular/platform-browser-dynamic
npm ERR! @angular/platform-browser-dynamic@"^15.0.1" from the root project
npm ERR! 2 more (@angular/router, the root project)
npm ERR! @angular/animations@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @angular/animations@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@15.0.3
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"15.0.3" from @angular/animations@15.0.3
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"*" 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 C:\Users\rejki\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rejki\AppData\Local\npm-cache\_logs\2022-12-14T10_44_35_365Z-debug.log
此錯誤是由於沖突的對等依賴項造成的。 您可以嘗試使用--legacy-peer-deps
運行npm install
命令,或者以其他方式修復您正在安裝的版本。
在您的情況下,似乎@angular/animations@15.0.3
需要安裝@angular/core@15.0.3
但您實際上是在安裝@angular/core@15.0.1
。
我通過運行命令修復了它:npm install --save conflicting-peer @15.0.1。 對於每一個有沖突的同伴。 謝謝你幫助我。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.