我一直收到這個錯誤。
Installing node modules
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/build-angular@15.0.0
npm ERR! Found: typescript@4.9.3
npm ERR! node_modules/typescript
npm ERR! dev typescript@"~4.9.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@"~4.8.2" from @angular-devkit/build-angular@15.0.0
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typescript@4.8.4
npm ERR! node_modules/typescript
npm ERR! peer typescript@"~4.8.2" from @angular-devkit/build-angular@15.0.0
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.0" 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 /tmp/npmcache.zQoom/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.zQoom/_logs/2022-11-19T21_40_57_670Z-debug-0.log
-----> Build failed
我試過 npm install --save --legacy-peer-deps,更新所有庫等,但我無法修復它。有人可以幫我嗎?
uj5u.com熱心網友回復:
--legacy-peer-deps很少是正確的選擇。解決沖突總是更好。
在這種情況下,您直接依賴于 TypeScript~4.9.3和~4.8.2來自的對等依賴性@angular-devkit/build-angular。這兩個版本約束是沖突的。
通常,您有兩種選擇:降級直接依賴或升級具有相關對等依賴的依賴。
但在這種情況下,您似乎已經在使用最新版本的@angular-devkit/build-angular. TypeScript 4.9才發布幾天,所以您的某些依賴項與它不兼容也就不足為奇了。
我建議您修改您的直接 TypeScript 依賴項以匹配您的對等依賴項:~4.8.2.
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/537175.html
下一篇:Npm安裝錯誤!資訊
