简体   繁体   English

将 angular/fire 7.5 与 angular 15 集成时,出现错误 Need to provide options, when not being deployed to hosting via source

[英]When integrating angular/fire 7.5 with angular 15, get error Need to provide options, when not being deployed to hosting via source

I am porting an app from angular8 with angular/fire 5.4 to angular15 with angular/fire 7.5.我正在将一个应用程序从具有 angular/fire 5.4 的 angular8 移植到具有 angular/fire 7.5 的 angular15。 I added the following to my AppModule imports section我将以下内容添加到我的 AppModule 导入部分

import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
import { provideFirestore, getFirestore } from '@angular/fire/firestore';
import { provideStorage, getStorage } from '@angular/fire/storage';
import { provideAuth, getAuth } from '@angular/fire/auth';
import { provideFunctions, getFunctions } from '@angular/fire/functions';

imports: [

    ... 
    AngularFireModule.initializeApp(environment.firebaseConfig),
    AngularFireStorageModule,
    AngularFirestoreModule,
    AngularFireAuthModule,
    AngularFireFunctionsModule,


    provideFirebaseApp(() => initializeApp(environment.firebaseConfig)),
    provideAuth(() => getAuth()),
    provideFirestore(() => getFirestore()),
    provideStorage(() => getStorage()),
    provideFunctions(() => getFunctions()),

    ...
],
providers: [
     { provide: FIREBASE_OPTIONS, useValue: environment.firebaseConfig }
]

But I am getting this error message: What am I missing?但我收到此错误消息:我错过了什么?

main.ts:14 FirebaseError: Firebase: Need to provide options, when not being deployed to hosting via source. (app/no-options).
    at initializeApp (index.esm2017.js:423:29)
    at getApp (index.esm2017.js:476:16)
    at getFunctions (index.esm2017.js:666:35)
    at angular-fire.js:227:48
    at angular-fire.js:160:59
    at _ZoneDelegate.invoke (zone.js:372:26)
    at Zone.run (zone.js:134:43)
    at NgZone.runOutsideAngular (core.mjs:24212:28)
    at runOutsideAngular (angular-fire.js:160:35)
    at angular-fire.js:227:21
    ```

I figured it out.我想到了。 I had a service which used AngularFireAuth but was not imported from the compat folder.我有一个使用 AngularFireAuth 但不是从 compat 文件夹导入的服务。 So while it compiled, it gave me that error during runtime.因此,在编译时,它在运行时给了我那个错误。 So if you use the compat mode of angularfire use it everywhere因此,如果您使用 angularfire 的兼容模式,请在任何地方使用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ionic 6,将Angular版本从13升级到15 - Ionic 6, upgrade Angular version from 13 to 15 错误 - 在 iOS 上运行 Ionic Angular App 时,Xcode 上出现错误 {"code":2100} 15.6.1 - error - ERROR {"code":2100} on Xcode when running Ionic Angular App on iOS 15.6.1 将 AWS Amplify Authenticator 与 Angular 一起使用时,标签栏未显示在移动浏览器上 - Tab Bar not displaying on Mobile Browser when using AWS Amplify Authenticator with Angular 角数管道在模态中不起作用 - Angular number pipe doesn't work in a modal 滚动不起作用,在 angular + ionic 6 项目中 - Scroll isn`t work , in angular + ionic 6 project 类型“字符串”不可分配给类型“RouterDirection” - Ionic 6 - angular - Type 'string' is not assignable to type 'RouterDirection' - Ionic 6 - angular Ionic V6 和 highchart-angular 无法正确显示 - Ionic V6 and highchart-angular doesnt display correctly 防止来电停止应用程序执行(Angular,Ionic) - Prevent an incoming call from stopping the application execution(Angular, Ionic) 如何使用适用于 iOS 的 AngularFire7 在 Ionic/Angular 中编写 AuthGuard? - How to write AuthGuard in Ionic/Angular with AngularFire7 that works on iOS? 在 Angular Ionic 6 中选择路由器转换 - Choosing router transition in Angular Ionic 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM