我将非常感谢在 Ionic 6 项目中安装 AngularFire 的任何帮助。错误说:
Packages installation failed, see above.
这是我的设置:
>> ionic info
Ionic:
Ionic CLI : 7.0.1 (C:\Users\xxx\AppData\Roaming\nvm\v18.12.1\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 6.6.3
@angular-devkit/build-angular : 15.2.4
@angular-devkit/schematics : 15.2.4
@angular/cli : 15.2.4
@ionic/angular-toolkit : 8.0.0
Capacitor:
Capacitor CLI : 4.7.1
@capacitor/android : not installed
@capacitor/core : 4.7.1
@capacitor/ios : not installed
Utility:
cordova-res : 0.15.4
native-run : 1.7.2
System:
NodeJS : v18.12.1 (C:\Program Files\nodejs\node.exe)
npm : 8.19.2
OS : Windows 10
>> ng add @angular/fire@latest --skip-confirmation
ℹ Using package manager: npm
✔ Package information loaded.
✖ Packages installation failed, see above.
>> npm outdated
Package Current Wanted Latest Location
@angular-devkit/build-angular 15.2.4 15.2.5 15.2.5 node_modules/@angular-devkit/build-angular
@angular/cli 15.2.4 15.2.5 15.2.5 node_modules/@angular/cli
@angular/common 15.2.4 15.2.6 15.2.6 node_modules/@angular/common
@angular/compiler 15.2.4 15.2.6 15.2.6 node_modules/@angular/compiler
@angular/compiler-cli 15.2.4 15.2.6 15.2.6 node_modules/@angular/compiler-cli
@angular/core 15.2.4 15.2.6 15.2.6 node_modules/@angular/core
@angular/forms 15.2.4 15.2.6 15.2.6 node_modules/@angular/forms
@angular/language-service 15.2.4 15.2.6 15.2.6 node_modules/@angular/language-service
@angular/platform-browser 15.2.4 15.2.6 15.2.6 node_modules/@angular/platform-browser
@angular/platform-browser-dynamic 15.2.4 15.2.6 15.2.6 node_modules/@angular/platform-browser-dynamic
@angular/router 15.2.4 15.2.6 15.2.6 node_modules/@angular/router
@capacitor/cli 4.7.1 4.7.1 4.7.3 node_modules/@capacitor/cli
@capacitor/core 4.7.1 4.7.1 4.7.3 node_modules/@capacitor/core
@ionic/angular 6.6.3 6.7.2 7.0.1 node_modules/@ionic/angular
@ionic/angular-toolkit 8.0.0 8.1.0 9.0.0 node_modules/@ionic/angular-toolkit
@types/jasmine 4.0.3 4.0.3 4.3.1 node_modules/@types/jasmine
@types/node 12.20.55 12.20.55 18.15.11 node_modules/@types/node
@typescript-eslint/eslint-plugin 5.3.0 5.3.0 5.58.0 node_modules/@typescript-eslint/eslint-plugin
@typescript-eslint/parser 5.3.0 5.3.0 5.58.0 node_modules/@typescript-eslint/parser
eslint 7.32.0 7.32.0 8.38.0 node_modules/eslint
eslint-plugin-import 2.22.1 2.22.1 2.27.5 node_modules/eslint-plugin-import
eslint-plugin-jsdoc 30.7.6 30.7.6 40.3.0 node_modules/eslint-plugin-jsdoc
eslint-plugin-prefer-arrow 1.2.2 1.2.2 1.2.3 node_modules/eslint-plugin-prefer-arrow
ionicons 6.1.3 6.1.3 7.1.0 node_modules/ionicons
jasmine-core 4.3.0 4.3.0 4.6.0 node_modules/jasmine-core
jasmine-spec-reporter 5.0.2 5.0.2 7.0.0 node_modules/jasmine-spec-reporter
rxjs 7.5.7 7.5.7 7.8.0 node_modules/rxjs
ts-node 8.3.0 8.3.0 10.9.1 node_modules/ts-node
typescript 4.8.4 4.8.4 5.0.4 node_modules/typescript
zone.js 0.11.8 0.11.8 0.13.0 node_modules/zone.js
更详细的错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/[email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"15.2.4" from @angular/[email protected]
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR! node_modules/@ionic/angular
npm ERR! @ionic/angular@"^6.1.9" from the root project
npm ERR! @angular/forms@"^15.0.0" from the root project
npm ERR! peer @angular/common@"^15.0.0 || ^16.0.0" from @angular/[email protected]
npm ERR! node_modules/@angular/google-maps
npm ERR! @angular/google-maps@"^15.2.6" from the root project
npm ERR! 5 more (@angular/platform-browser, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"15.2.6" from @angular/[email protected]
npm ERR! node_modules/@angular/service-worker
npm ERR! peerOptional @angular/service-worker@"^15.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.0" from the root project
npm ERR! @angular/service-worker@"^15.2.6" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"15.2.6" from @angular/[email protected]
npm ERR! node_modules/@angular/service-worker
npm ERR! peerOptional @angular/service-worker@"^15.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.0" from the root project
npm ERR! @angular/service-worker@"^15.2.6" 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!
使用 ng update 将你的角度版本更新到 (15.2.6),然后再试一次。这个问题应该消失了。