skip to Main Content

I’ve installed node 18.10.0 and I’m trying to create a new Angular 15 project that uses Firebase 9 (hosting, firestore database and authentication) and after the commands shown below the node_modules doesn’t have the @angular/fire directory, so the following in app.module.ts import doesn’t work

import { AngulareFireModule } from '@angular/fire';
Import { AngularFirestoreModule } from '@angular/fire/firestore';

AngularFireModule.initializeApp(environment.firebase),

AngularFirestoreModule

I really want to stay with Firebase 9, but happy to downgrade Angular. Any ideas on what to do?

nvm install 10.10.0

nvm use 18.10.0

npm install -g @angular/[email protected]

ng new myapp

cd myapp

npm install bootstrap

npm install [email protected]

npm install -g firebase-tools

firebase init

2

Answers


  1. Chosen as BEST ANSWER

    Solved with

    Ng add @angular/fire


  2. I’m digging around to rectify issues I have writing to the Firestore emulators but shouldn’t the imports be the following for Firebase 9?

    import { provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
    import { getStorage, provideStorage } from '@angular/fire/storage';
    import { getFirestore, provideFirestore, connectFirestoreEmulator  } from '@angular/fire/firestore';
    import { getAuth, provideAuth, connectAuthEmulator } from '@angular/fire/auth';
    import { getFunctions, provideFunctions, connectFunctionsEmulator } from '@angular/fire/functions';
    
    
    let firebaseApp = provideFirebaseApp(() => initializeApp(environment.firebase));
    let firestore = provideFirestore(() => getFirestore());
    let auth = provideAuth(() => getAuth());
    let functions = provideFunctions(() => getFunctions());
    let storage = provideStorage(() => getStorage());
    

    or a variation of this, however you want to handle it

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search