无法安装 angular fire @angular/fire@latest。

huangapple go评论59阅读模式
英文:

Unable to install angular fire @angular/fire@latest

问题

I just started freshly a new angular material project. And it fails with below errors

moblizeit@Vikrams-MBP scanbuddyadmin % ng add @angular/fire@latest
ℹ Using package manager: npm
⚠ Package has unmet peer dependencies. Adding the package may not succeed.

The package @angular/fire@latest will be installed and executed.
Would you like to proceed? Yes
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: scanbuddyadmin@0.0.0
npm ERR! Found: @angular/common@16.0.2
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@^16.0.0 from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 from @angular/fire@7.5.0
npm ERR! node_modules/@angular/fire
npm ERR!   @angular/fire@7.5.0 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! 
npm ERR! See /Users/moblizeit/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/moblizeit/.npm/_logs/2023-05-21T03_28_48_338Z-debug-0.log
✖ Packages installation failed, see above.

The package.json looks like the below

{
  "name": "scanbuddyadmin",
  "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": "^16.0.0",
    "@angular/cdk": "^16.0.1",
    "@angular/common": "^16.0.0",
    "@angular/compiler": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/fire": "^0.0.0",
    "@angular/forms": "^16.0.0",
    "@angular/material": "^16.0.1",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0",
    "@angular/router": "^16.0.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.2",
    "@angular/cli": "~16.0.2",
    "@angular/compiler-cli": "^16.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~5.0.2"
  }
}

I have no idea how to resolve it?

英文:

I just started freshly a new angular material project. And it fails with below errors

moblizeit@Vikrams-MBP scanbuddyadmin % ng add @angular/fire@latest
ℹ Using package manager: npm
⚠ Package has unmet peer dependencies. Adding the package may not succeed.

The package @angular/fire@latest will be installed and executed.
Would you like to proceed? Yes
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: scanbuddyadmin@0.0.0
npm ERR! Found: @angular/common@16.0.2
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^16.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0" from @angular/fire@7.5.0
npm ERR! node_modules/@angular/fire
npm ERR!   @angular/fire@"7.5.0" 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! 
npm ERR! See /Users/moblizeit/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/moblizeit/.npm/_logs/2023-05-21T03_28_48_338Z-debug-0.log
✖ Packages installation failed, see above.

The package.json looks like the below

{
  "name": "scanbuddyadmin",
  "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": "^16.0.0",
    "@angular/cdk": "^16.0.1",
    "@angular/common": "^16.0.0",
    "@angular/compiler": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/fire": "^0.0.0",
    "@angular/forms": "^16.0.0",
    "@angular/material": "^16.0.1",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0",
    "@angular/router": "^16.0.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.2",
    "@angular/cli": "~16.0.2",
    "@angular/compiler-cli": "^16.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~5.0.2"
  }
}

I have no idea how to resolve it?

答案1

得分: 1

@angular/fire@"7.5.0" 需要 Angular 版本为 12-15,但你的 Angular 版本是 16。但你可以使用 --legacy-peer-deps 来添加它。

英文:

the @angular/fire@"7.5.0" wants a angular version of 12-15 but you angular version is 16. but you can add it with --legacy-peer-deps.

答案2

得分: 1

将以下内容添加到您的 package.json 文件中:

"overrides": {
  "@angular/fire": {
    "@angular/common": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0"
  }
}

此问题似乎将在 Angular Fire 7.6.0 中得到修复。

英文:

Add this to your package.json:

"overrides": {
  "@angular/fire": {
    "@angular/common": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0"
  }
}

https://github.com/angular/angularfire/issues/3348#issuecomment-1536262612

Also it seems that this will be fixed with Angular Fire 7.6.0

huangapple
  • 本文由 发表于 2023年5月21日 11:32:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76298183.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定