J4N*_*J4N 5 angular-upgrade angular
我有一个 Angular 12 应用程序,我正在尝试将其升级到 Angular 13。
\n根据https://update.angular.io/?l=2&v=12.0-13.0我应该运行:
\nnpx @angular/cli@13 update @angular/core@13 @angular/cli@13\nRun Code Online (Sandbox Code Playgroud)\n但是当我这样做时,我收到以下错误:
\nnpx @angular/cli@13 update @angular/core@13 @angular/cli@13\nThe installed local Angular CLI version is older than the latest stable version.\nInstalling a temporary version to perform the update.\n\xe2\x9c\x94 Package successfully installed.\nUsing package manager: \'npm\'\nCollecting installed dependencies...\nFound 38 dependencies.\nFetching dependency metadata from registry...\n Updating package.json with dependency @angular-devkit/build-angular @ "13.0.2" (was "12.1.1")...\n Updating package.json with dependency @angular/cli @ "13.0.2" (was "12.1.1")...\n Updating package.json with dependency @angular/compiler-cli @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency typescript @ "4.4.4" (was "4.3.5")...\n Updating package.json with dependency @angular/animations @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/common @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/compiler @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/core @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/forms @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/platform-browser @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/platform-browser-dynamic @ "13.0.1" (was "12.1.1")...\n Updating package.json with dependency @angular/router @ "13.0.1" (was "12.1.1")...\n UPDATE package.json (1566 bytes)\nnpm ERR! code ERESOLVE\nnpm ERR! ERESOLVE could not resolve\nnpm ERR!\nnpm ERR! While resolving: scrum-poker-app@0.0.0\nnpm ERR! Found: @angular-devkit/build-angular@12.1.1\nnpm ERR! node_modules/@angular-devkit/build-angular\nnpm ERR! dev @angular-devkit/build-angular@"~13.0.2" from the root project\nnpm ERR!\nnpm ERR! Could not resolve dependency:\nnpm ERR! dev @angular-devkit/build-angular@"~13.0.2" from the root project\nnpm ERR!\nnpm ERR! Conflicting peer dependency: @angular/compiler-cli@13.0.1\nnpm ERR! node_modules/@angular/compiler-cli\nnpm ERR! peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.2\nnpm ERR! node_modules/@angular-devkit/build-angular\nnpm ERR! dev @angular-devkit/build-angular@"~13.0.2" 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!\n\n\xe2\x9c\x96 Package install failed, see above.\nRun Code Online (Sandbox Code Playgroud)\n我也尝试过使用该--force标志,它有效,但是当我执行 时npm install,我得到了这个:
npm install\nnpm ERR! code ERESOLVE\nnpm ERR! ERESOLVE could not resolve\nnpm ERR!\nnpm ERR! While resolving: scrum-poker-app@0.0.0\nnpm ERR! Found: @angular-devkit/build-angular@12.1.1\nnpm ERR! node_modules/@angular-devkit/build-angular\nnpm ERR! dev @angular-devkit/build-angular@"~13.0.2" from the root project\nnpm ERR!\nnpm ERR! Could not resolve dependency:\nnpm ERR! dev @angular-devkit/build-angular@"~13.0.2" from the root project\nnpm ERR!\nnpm ERR! Conflicting peer dependency: @angular/compiler-cli@13.0.1\nnpm ERR! node_modules/@angular/compiler-cli\nnpm ERR! peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.2\nnpm ERR! node_modules/@angular-devkit/build-angular\nnpm ERR! dev @angular-devkit/build-angular@"~13.0.2" 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编辑\n我当前的package.json
\n{\n "name": "scrum-poker-app",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "watch": "ng build --watch --configuration development",\n "test": "ng test"\n },\n "private": true,\n "dependencies": {\n "@angular/animations": "~12.1.0",\n "@angular/cdk": "^12.1.1",\n "@angular/common": "~12.1.0",\n "@angular/compiler": "~12.1.0",\n "@angular/core": "~12.1.0",\n "@angular/fire": "^6.1.5",\n "@angular/forms": "~12.1.0",\n "@angular/platform-browser": "~12.1.0",\n "@angular/platform-browser-dynamic": "~12.1.0",\n "@angular/router": "~12.1.0",\n "@datorama/akita": "^6.2.0",\n "@datorama/akita-ng-router-store": "^6.0.0",\n "@firebase/firestore-types": "^2.3.0",\n "akita-ng-fire": "^6.0.0",\n "date-fns": "^2.22.1",\n "firebase": "^8.7.0",\n "firebaseui": "^4.8.0",\n "firebaseui-angular": "^5.1.3",\n "ngx-date-fns": "^8.1.0",\n "primeflex": "^2.0.0",\n "primeicons": "^4.1.0",\n "primeng": "^12.0.0",\n "rxjs": "~6.6.0",\n "tslib": "^2.2.0",\n "zone.js": "~0.11.4"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "~12.1.0",\n "@angular/cli": "~12.1.0",\n "@angular/compiler-cli": "~12.1.0",\n "@datorama/akita-ngdevtools": "^6.0.0",\n "@types/jasmine": "~3.6.0",\n "@types/node": "^12.11.1",\n "jasmine-core": "~3.7.0",\n "karma": "~6.3.0",\n "karma-chrome-launcher": "~3.1.0",\n "karma-coverage": "~2.0.3",\n "karma-jasmine": "~4.0.0",\n "karma-jasmine-html-reporter": "^1.5.0",\n "typescript": "~4.3.2"\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n
看起来像是 npm 的问题
我有“npm --version”--> 8.5.4 但提到版本 7.x 会产生相同的错误
这里涵盖了这个问题: https ://github.com/angular/angular-cli/issues/21204
建议的解决方法是:
我用了第一个:
npm i
npx @angular/cli@13 update @angular/core@13 @angular/cli@13 --force
Run Code Online (Sandbox Code Playgroud)
这里同样的问题。仅在我完成了npm install.
npm i
npx @angular/cli@13 update @angular/core@13 @angular/cli@13
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8350 次 |
| 最近记录: |