reactjsfirebase-storage

firebase service storage is not available - React Js


I am trying to use firebase storage with React JS. but there is a error like this. service storage is not available

here is my firebase config file.

import { initializeApp } from "firebase/app";
import { Auth, getAuth } from "firebase/auth";
import { Firestore, getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";

// web app's Firebase configuration
const firebaseConfig = {
  apiKey: import.meta.env.VITE_API_KEY,
  authDomain: import.meta.env.VITE_AUTH_DOMAIN,
  projectId: import.meta.env.VITE_PROJECT_ID,
  storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
  messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
  appId: import.meta.env.VITE_APP_ID,
};

// Initialize Firebase
export const firebase = initializeApp(firebaseConfig);

// exports
export const auth: Auth = getAuth(firebase);
export const db: Firestore = getFirestore(firebase);
export const storage = getStorage(firebase);

I have checked all the configs & everything is ok. Also I reinstalled the firebase package but nothing works out.


Solution

  • problem solved!

    maybe there is some firebase version issue in yarn.lock file. So I just deleted the yarn.lock file and after that, I've run the yarn command again. now it's working pretty fine