我在一个Angular项目中使用了Angularfire,当更新Angular版本到16.2.0时,'firebase/auth'和'firebase/firestore'抛出了几个错误。然后我做了一个干净的安装,同样的事情发生了,只要我安装@angular/fire
。
版本信息Angular:16.2.0
Firebase:10.4.0
AngularFire:7.6.1
SO:Windows 10
[*]
"dependencies": {
"@angular/animations": "^16.2.0",
"@angular/cdk": "^16.2.6",
"@angular/common": "^16.2.0",
"@angular/compiler": "^16.2.0",
"@angular/core": "^16.2.0",
"@angular/fire": "^7.6.1",
"@angular/forms": "^16.2.0",
"@angular/material": "^16.2.6",
"@angular/platform-browser": "^16.2.0",
"@angular/platform-browser-dynamic": "^16.2.0",
"@angular/router": "^16.2.0",
"@ngrx/effects": "^16.2.0",
"@ngrx/entity": "^16.2.0",
"@ngrx/store": "^16.2.0",
"@ngrx/store-devtools": "^16.2.0",
"firebase": "^10.4.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.13.0" },
AppModule
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
StoreModule.forRoot({}, {}),
EffectsModule.forRoot([]),
StoreDevtoolsModule.instrument({ maxAge: 25, logOnly: !isDevMode() }),
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideAuth(() => getAuth()),
provideFirestore(() => getFirestore()),
provideFunctions(() => getFunctions()),
],
错误:
./node_modules/rxfire/auth/index.esm.js:28:22-40 - Error: export 'onAuthStateChanged' (imported as 'onAuthStateChanged') was not found in 'firebase/auth' (module has no exports)
./node_modules/rxfire/auth/index.esm.js:41:22-38 - Error: export 'onIdTokenChanged' (imported as 'onIdTokenChanged') was not found in 'firebase/auth' (module has no exports)
./node_modules/rxfire/auth/index.esm.js:54:23-33 - Error: export 'getIdToken' (imported as 'getIdToken') was not found in 'firebase/auth' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:69:22-32 - Error: export 'onSnapshot' (imported as 'onSnapshot')
was not found in 'firebase/firestore' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:184:39-47 - Error: export 'refEqual' (imported as 'refEqual') was not found in 'firebase/firestore' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:189:47-55 - Error: export 'refEqual' (imported as 'refEqual') was not found in 'firebase/firestore' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:203:39-47 - Error: export 'refEqual' (imported as 'refEqual') was not found in 'firebase/firestore' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:280:17-25 - Error: export 'refEqual' (imported as 'refEqual') was not found in 'firebase/firestore' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:290:19-27 - Error: export 'refEqual' (imported as 'refEqual') was not found in 'firebase/firestore' (module has no exports)
./node_modules/rxfire/firestore/index.esm.js:358:14-32 - Error: export 'getCountFromServer' (imported as 'getCountFromServer') was not found in 'firebase/firestore' (module has no exports)
为了验证问题的原因,我在一个干净的项目上执行了安装,错误再次出现。一旦我卸载@angular/fire
,问题就消失了。如果我重新安装软件包,错误仍然存在。
1条答案
按热度按时间gwbalxhn1#
它应该是这样的:“firebase”:“^9.16.0”,“@angular/fire”:“^7.6.1”,
注意根据angular/fire docs 7.6支持firebase 9