Angular 17 依赖项冲突

问题描述 投票:0回答:1

我刚刚使用 Angular 17 初始化了一个新项目,但我不知道为什么出现错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"^17.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"17.0.1" from @angular/[email protected]
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"^17.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!

@angular/core@"17.0.1" from @angular/[email protected]
:我知道没有17.0.1版本。但只有 17.0.0.

当我发布问题时,我找到了解决方案:

我安装了:

npm install @angular/[email protected]
npm install @angular/[email protected]

最后:

ng update

angular npm dependencies node-modules
1个回答
0
投票

删除你的

package-lock.json
和你
node_modules
,你就会没事的。

© www.soinside.com 2019 - 2024. All rights reserved.