我尝试使用官方升级指南将当前的 Angular 12 应用程序更新到 13,但失败了。我不确定问题是什么,坦率地说,我不认为 npm 错误消息是不言自明的。
这是输出:
PS C:\Projects\frontend> npx ng update @angular/cli@13
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 13.3.9 to perform the update.
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 46 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular-devkit/build-angular @ "13.3.9" (was "12.2.18")...
Updating package.json with dependency @angular/cli @ "13.3.9" (was "12.2.18")...
Updating package.json with dependency @angular/compiler-cli @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency typescript @ "4.6.4" (was "4.3.5")...
Updating package.json with dependency @angular/animations @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/common @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/compiler @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/core @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/forms @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/platform-browser @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "13.3.11" (was "12.2.16")...
Updating package.json with dependency @angular/router @ "13.3.11" (was "12.2.16")...
UPDATE package.json (2773 bytes)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected] /cdn-cgi/l/email-protection
npm ERR! Found: @angular-devkit/[email protected] /cdn-cgi/l/email-protection
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~13.3.9" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~13.3.9" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected] /cdn-cgi/l/email-protection
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^13.0.0 || ^13.3.0-rc.0" from @angular-devkit/[email protected] /cdn-cgi/l/email-protection
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~13.3.9" 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.
有人可以告诉我问题是什么以及如何升级吗?
出现此错误是因为您拥有节点 16.X 或更高版本。 npm 比以前更严格了。
解决方案一:
降级你的节点版本
解决方案2:
通过将 build-Angular 升级到 13.3.9 来修复这些错误
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)