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

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

Unable to install angular fire @angular/fire@latest

问题

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

  1. moblizeit@Vikrams-MBP scanbuddyadmin % ng add @angular/fire@latest
  2. Using package manager: npm
  3. Package has unmet peer dependencies. Adding the package may not succeed.
  4. The package @angular/fire@latest will be installed and executed.
  5. Would you like to proceed? Yes
  6. npm ERR! code ERESOLVE
  7. npm ERR! ERESOLVE unable to resolve dependency tree
  8. npm ERR!
  9. npm ERR! While resolving: scanbuddyadmin@0.0.0
  10. npm ERR! Found: @angular/common@16.0.2
  11. npm ERR! node_modules/@angular/common
  12. npm ERR! @angular/common@^16.0.0 from the root project
  13. npm ERR!
  14. npm ERR! Could not resolve dependency:
  15. npm ERR! peer @angular/common@^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 from @angular/fire@7.5.0
  16. npm ERR! node_modules/@angular/fire
  17. npm ERR! @angular/fire@7.5.0 from the root project
  18. npm ERR!
  19. npm ERR! Fix the upstream dependency conflict, or retry
  20. npm ERR! this command with --force, or --legacy-peer-deps
  21. npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
  22. npm ERR!
  23. npm ERR! See /Users/moblizeit/.npm/eresolve-report.txt for a full report.
  24. npm ERR! A complete log of this run can be found in:
  25. npm ERR! /Users/moblizeit/.npm/_logs/2023-05-21T03_28_48_338Z-debug-0.log
  26. Packages installation failed, see above.

The package.json looks like the below

  1. {
  2. "name": "scanbuddyadmin",
  3. "version": "0.0.0",
  4. "scripts": {
  5. "ng": "ng",
  6. "start": "ng serve",
  7. "build": "ng build",
  8. "watch": "ng build --watch --configuration development",
  9. "test": "ng test"
  10. },
  11. "private": true,
  12. "dependencies": {
  13. "@angular/animations": "^16.0.0",
  14. "@angular/cdk": "^16.0.1",
  15. "@angular/common": "^16.0.0",
  16. "@angular/compiler": "^16.0.0",
  17. "@angular/core": "^16.0.0",
  18. "@angular/fire": "^0.0.0",
  19. "@angular/forms": "^16.0.0",
  20. "@angular/material": "^16.0.1",
  21. "@angular/platform-browser": "^16.0.0",
  22. "@angular/platform-browser-dynamic": "^16.0.0",
  23. "@angular/router": "^16.0.0",
  24. "rxjs": "~7.8.0",
  25. "tslib": "^2.3.0",
  26. "zone.js": "~0.13.0"
  27. },
  28. "devDependencies": {
  29. "@angular-devkit/build-angular": "^16.0.2",
  30. "@angular/cli": "~16.0.2",
  31. "@angular/compiler-cli": "^16.0.0",
  32. "@types/jasmine": "~4.3.0",
  33. "jasmine-core": "~4.6.0",
  34. "karma": "~6.4.0",
  35. "karma-chrome-launcher": "~3.2.0",
  36. "karma-coverage": "~2.2.0",
  37. "karma-jasmine": "~5.1.0",
  38. "karma-jasmine-html-reporter": "~2.0.0",
  39. "typescript": "~5.0.2"
  40. }
  41. }

I have no idea how to resolve it?

英文:

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

  1. moblizeit@Vikrams-MBP scanbuddyadmin % ng add @angular/fire@latest
  2. Using package manager: npm
  3. Package has unmet peer dependencies. Adding the package may not succeed.
  4. The package @angular/fire@latest will be installed and executed.
  5. Would you like to proceed? Yes
  6. npm ERR! code ERESOLVE
  7. npm ERR! ERESOLVE unable to resolve dependency tree
  8. npm ERR!
  9. npm ERR! While resolving: scanbuddyadmin@0.0.0
  10. npm ERR! Found: @angular/common@16.0.2
  11. npm ERR! node_modules/@angular/common
  12. npm ERR! @angular/common@"^16.0.0" from the root project
  13. npm ERR!
  14. npm ERR! Could not resolve dependency:
  15. npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0" from @angular/fire@7.5.0
  16. npm ERR! node_modules/@angular/fire
  17. npm ERR! @angular/fire@"7.5.0" from the root project
  18. npm ERR!
  19. npm ERR! Fix the upstream dependency conflict, or retry
  20. npm ERR! this command with --force, or --legacy-peer-deps
  21. npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
  22. npm ERR!
  23. npm ERR! See /Users/moblizeit/.npm/eresolve-report.txt for a full report.
  24. npm ERR! A complete log of this run can be found in:
  25. npm ERR! /Users/moblizeit/.npm/_logs/2023-05-21T03_28_48_338Z-debug-0.log
  26. Packages installation failed, see above.

The package.json looks like the below

  1. {
  2. "name": "scanbuddyadmin",
  3. "version": "0.0.0",
  4. "scripts": {
  5. "ng": "ng",
  6. "start": "ng serve",
  7. "build": "ng build",
  8. "watch": "ng build --watch --configuration development",
  9. "test": "ng test"
  10. },
  11. "private": true,
  12. "dependencies": {
  13. "@angular/animations": "^16.0.0",
  14. "@angular/cdk": "^16.0.1",
  15. "@angular/common": "^16.0.0",
  16. "@angular/compiler": "^16.0.0",
  17. "@angular/core": "^16.0.0",
  18. "@angular/fire": "^0.0.0",
  19. "@angular/forms": "^16.0.0",
  20. "@angular/material": "^16.0.1",
  21. "@angular/platform-browser": "^16.0.0",
  22. "@angular/platform-browser-dynamic": "^16.0.0",
  23. "@angular/router": "^16.0.0",
  24. "rxjs": "~7.8.0",
  25. "tslib": "^2.3.0",
  26. "zone.js": "~0.13.0"
  27. },
  28. "devDependencies": {
  29. "@angular-devkit/build-angular": "^16.0.2",
  30. "@angular/cli": "~16.0.2",
  31. "@angular/compiler-cli": "^16.0.0",
  32. "@types/jasmine": "~4.3.0",
  33. "jasmine-core": "~4.6.0",
  34. "karma": "~6.4.0",
  35. "karma-chrome-launcher": "~3.2.0",
  36. "karma-coverage": "~2.2.0",
  37. "karma-jasmine": "~5.1.0",
  38. "karma-jasmine-html-reporter": "~2.0.0",
  39. "typescript": "~5.0.2"
  40. }
  41. }

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 文件中:

  1. "overrides": {
  2. "@angular/fire": {
  3. "@angular/common": "^16.0.0",
  4. "@angular/core": "^16.0.0",
  5. "@angular/platform-browser": "^16.0.0",
  6. "@angular/platform-browser-dynamic": "^16.0.0"
  7. }
  8. }

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

英文:

Add this to your package.json:

  1. "overrides": {
  2. "@angular/fire": {
  3. "@angular/common": "^16.0.0",
  4. "@angular/core": "^16.0.0",
  5. "@angular/platform-browser": "^16.0.0",
  6. "@angular/platform-browser-dynamic": "^16.0.0"
  7. }
  8. }

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:

确定