admin管理员组

文章数量:1290978

I am trying to set up Firebase in a React Native project using the Firebase Modular SDK (version 9+). However, I am encountering the following error:

Property 'apps' does not exist on type '(options: FirebaseAppOptions, name?: string | undefined) => FirebaseApp'.

I installed all the NPM packeges, made a .env file and changed the babel.config.js

Initialized Firebase in a utility file (firebase.ts

import { initializeApp, getApps, getApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';
import { API_KEY, AUTH_DOMAIN, PROJECT_ID, STORAGE_BUCKET, MESSAGING_SENDER_ID, APP_ID } from '@env';

const firebaseConfig = {
  apiKey: API_KEY,
  authDomain: AUTH_DOMAIN,
  projectId: PROJECT_ID,
  storageBucket: STORAGE_BUCKET,
  messagingSenderId: MESSAGING_SENDER_ID,
  appId: APP_ID,
};

const app = !getApps().length ? initializeApp(firebaseConfig) : getApp();

export const firebaseAuth = getAuth(app);
export const firebaseFirestore = getFirestore(app);

Tried everything i could but i have no clue anymore.

本文标签: javascriptIssues with Firebase Initialization and Environment Variables in React NativeStack Overflow