ctw*_*twx 11 node.js npm angular
我尝试使用官方升级指南将当前的 Angular 12 应用程序更新到 13,但失败了。我不确定问题是什么,坦率地说,我不认为 npm 错误消息是不言自明的。
\n这是输出:
\nPS C:\\Projects\\frontend> npx ng update @angular/cli@13\nThe installed Angular CLI version is outdated.\nInstalling a temporary Angular CLI versioned 13.3.9 to perform the update.\n\xe2\x9c\x94 Package successfully installed.\nUsing package manager: 'npm'\nCollecting installed dependencies...\nFound 46 dependencies.\nFetching dependency metadata from registry...\n Updating package.json with dependency @angular-devkit/build-angular @ "13.3.9" (was "12.2.18")...\n Updating package.json with dependency @angular/cli @ "13.3.9" (was "12.2.18")...\n Updating package.json with dependency @angular/compiler-cli @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency typescript @ "4.6.4" (was "4.3.5")...\n Updating package.json with dependency @angular/animations @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/common @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/compiler @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/core @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/forms @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/platform-browser @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/platform-browser-dynamic @ "13.3.11" (was "12.2.16")...\n Updating package.json with dependency @angular/router @ "13.3.11" (was "12.2.16")...\n UPDATE package.json (2773 bytes)\nnpm ERR! code ERESOLVE\nnpm ERR! ERESOLVE could not resolve\nnpm ERR!\nnpm ERR! While resolving: frontend@0.0.0\nnpm ERR! Found: @angular-devkit/build-angular@12.2.18\nnpm ERR! node_modules/@angular-devkit/build-angular\nnpm ERR! dev @angular-devkit/build-angular@"~13.3.9" from the root project\nnpm ERR!\nnpm ERR! Could not resolve dependency:\nnpm ERR! dev @angular-devkit/build-angular@"~13.3.9" from the root project\nnpm ERR!\nnpm ERR! Conflicting peer dependency: @angular/compiler-cli@13.3.11\nnpm ERR! node_modules/@angular/compiler-cli\nnpm ERR! peer @angular/compiler-cli@"^13.0.0 || ^13.3.0-rc.0" from @angular-devkit/build-angular@13.3.9\nnpm ERR! node_modules/@angular-devkit/build-angular\nnpm ERR! dev @angular-devkit/build-angular@"~13.3.9" from the root project\nnpm ERR!\nnpm ERR! Fix the upstream dependency conflict, or retry\nnpm ERR! this command with --force, or --legacy-peer-deps\nnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.\nRun Code Online (Sandbox Code Playgroud)\n有人可以告诉我问题是什么以及如何升级吗?
\n小智 9
出现此错误是因为您拥有节点 16.X 或更高版本。npm 比以前更严格了。
解决方案1:降级您的节点版本
解决方案 2:通过将 build-angle 升级到 13.3.9 来修复这些错误
小智 8
正如 @lyngvi 的评论中所建议的,这对我有用:
legacy-peer-deps=true| 归档时间: |
|
| 查看次数: |
26681 次 |
| 最近记录: |