我总是收到这个错误
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安装--保存--传统对等部署,更新所有库等,但我不能修复它。有人能帮助我吗?
1条答案
按热度按时间dnph8jn41#
--legacy-peer-deps
很少是正确的选择。解决冲突总是更好。在本例中,您对TypeScript
~4.9.3
有一个直接依赖项,而对@angular-devkit/build-angular
有一个对等依赖项,即~4.8.2
。这两个版本约束是冲突的。通常,您有两种选择:降级直接依赖关系或升级具有相关对等依赖关系的依赖关系。
但是在本例中,看起来您已经在使用最新版本的
@angular-devkit/build-angular
。TypeScript 4.9是only a few days old,因此您的一些依赖项与它不兼容也就不足为奇了。我建议您修改您的直接TypeScript依赖项,以匹配您的对等依赖项:
~4.8.2
.