Angular 更新返回依赖错误

erg*_*dar 2 npm angular

我正在尝试更新我的 Angular 项目,并且 ng update @angular/core 会抛出以下错误:

\n
Using package manager: 'npm'\nCollecting installed dependencies...\nFound 41 dependencies.\nFetching dependency metadata from registry...\n    Updating package.json with dependency @angular/compiler-cli @ "11.0.7" (was "10.1.6")...\n    Updating package.json with dependency @angular/animations @ "11.0.7" (was "10.1.6")...\n    Updating package.json with dependency @angular/common @ "11.0.7" (was "10.1.6")...\n    Updating package.json with dependency @angular/compiler @ "11.0.7" (was "10.1.6")...\n    Updating package.json with dependency @angular/core @ "11.0.7" (was "10.1.6")...\n    Updating package.json with dependency @angular/platform-browser @ "11.0.7" (was "10.1.6")...\n    Updating package.json with dependency @angular/platform-browser-dynamic @ "11.0.7" (was "10.1.6")...\n  UPDATE package.json (1654 bytes)\n| Installing packages (npm)...npm ERR! code ERESOLVE\nnpm ERR! ERESOLVE unable to resolve dependency tree\nnpm ERR!\nnpm ERR! Found: @angular/animations@10.1.6\nnpm ERR! node_modules/@angular/animations\nnpm ERR!   @angular/animations@"^11.0.7" from the root project\nnpm ERR! \nnpm ERR! Could not resolve dependency:\nnpm ERR! @angular/animations@"^11.0.7" 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.\nnpm ERR!\nnpm ERR! See C:\\Users\\user\\AppData\\Local\\npm-cache\\eresolve-report.txt for a full report.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     C:\\Users\\user\\AppData\\Local\\npm-cache\\_logs\\2021-01-11T15_58_29_106Z-debug.log\n\xc3\x97 Package install failed, see above.\n\xc3\x97 Migration failed. See above for further details.\n
Run Code Online (Sandbox Code Playgroud)\n

ng update @angular/core --force返回相同的错误。

\n

我尝试@angular/animations@11.0.7手动安装,但它返回相同的错误。

\n

我应该怎么办?

\n

感谢您提前的建议!

\n

sel*_* mn 5

尝试:

npm install --legacy-peer-deps