首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法从角度12升级到13角

无法从角度12升级到13角
EN

Stack Overflow用户
提问于 2021-11-14 10:02:57
回答 2查看 4K关注 0票数 3

我有一个角12应用程序,我正在尝试升级到角13。

根据https://update.angular.io/?l=2&v=12.0-13.0,我应该运行:

代码语言:javascript
运行
复制
npx @angular/cli@13 update @angular/core@13 @angular/cli@13

但是,当我这样做时,我会得到以下错误:

代码语言:javascript
运行
复制
npx @angular/cli@13 update @angular/core@13 @angular/cli@13
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 38 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular-devkit/build-angular @ "13.0.2" (was "12.1.1")...
    Updating package.json with dependency @angular/cli @ "13.0.2" (was "12.1.1")...
    Updating package.json with dependency @angular/compiler-cli @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency typescript @ "4.4.4" (was "4.3.5")...
    Updating package.json with dependency @angular/animations @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/common @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/compiler @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/core @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/forms @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/platform-browser @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "13.0.1" (was "12.1.1")...
    Updating package.json with dependency @angular/router @ "13.0.1" (was "12.1.1")...
  UPDATE package.json (1566 bytes)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: scrum-poker-app@0.0.0
npm ERR! Found: @angular-devkit/build-angular@12.1.1
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~13.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~13.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/compiler-cli@13.0.1
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.2
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~13.0.2" 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!

✖ Package install failed, see above.

我也尝试过使用--force标志,它可以工作,但是当我执行npm install时,我得到了以下内容:

代码语言:javascript
运行
复制
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: scrum-poker-app@0.0.0
npm ERR! Found: @angular-devkit/build-angular@12.1.1
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~13.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~13.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/compiler-cli@13.0.1
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/build-angular@13.0.2
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~13.0.2" 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.

知道我错过了什么吗?

编辑我的当前package.json

代码语言:javascript
运行
复制
{
  "name": "scrum-poker-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~12.1.0",
    "@angular/cdk": "^12.1.1",
    "@angular/common": "~12.1.0",
    "@angular/compiler": "~12.1.0",
    "@angular/core": "~12.1.0",
    "@angular/fire": "^6.1.5",
    "@angular/forms": "~12.1.0",
    "@angular/platform-browser": "~12.1.0",
    "@angular/platform-browser-dynamic": "~12.1.0",
    "@angular/router": "~12.1.0",
    "@datorama/akita": "^6.2.0",
    "@datorama/akita-ng-router-store": "^6.0.0",
    "@firebase/firestore-types": "^2.3.0",
    "akita-ng-fire": "^6.0.0",
    "date-fns": "^2.22.1",
    "firebase": "^8.7.0",
    "firebaseui": "^4.8.0",
    "firebaseui-angular": "^5.1.3",
    "ngx-date-fns": "^8.1.0",
    "primeflex": "^2.0.0",
    "primeicons": "^4.1.0",
    "primeng": "^12.0.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.2.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.1.0",
    "@angular/cli": "~12.1.0",
    "@angular/compiler-cli": "~12.1.0",
    "@datorama/akita-ngdevtools": "^6.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~3.7.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "typescript": "~4.3.2"
  }
}
EN

回答 2

Stack Overflow用户

发布于 2022-03-10 23:06:43

这看起来像是国家预防机制的问题

我有"npm --版本“--> 8.5.4,但是提到7.x版本会产生相同的错误。

这个问题将在这里讨论:https://github.com/angular/angular-cli/issues/21204

建议的解决办法是:

  • 将- force选项传递给ng更新,这将将强制标志传播到npm。
  • 降级为npm 6
  • ,它作为包管理器

切换到纱线。

我用了第一个:

代码语言:javascript
运行
复制
npm i
npx @angular/cli@13 update @angular/core@13 @angular/cli@13 --force
票数 3
EN

Stack Overflow用户

发布于 2022-01-31 20:04:57

这里也有同样的问题。只有在我做了npm install之后,我才能从第12角升级到13.2角。

代码语言:javascript
运行
复制
npm i
npx @angular/cli@13 update @angular/core@13 @angular/cli@13
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69962000

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档