Requires some help on linking firebase with Expo

Hi all, this is my first time touching expo as I am interested in App Development and also doing a project on App Development. But I faced a issue and if anyone can help, I would greatly appreciate it. Thank you!

My issue is

TypeError: undefined is not an object (evaluating '_firebase.auth.createUserWithEmailAndPassword')

I have the following (firebase.js):

// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
// TODO: Add SDKs for Firebase products that you want to use
import {getAuth} from "firebase/auth";

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: ****,
  authDomain: ****,
  projectId: ****,
  storageBucket: ****,
  messagingSenderId: ****,
  appId: ****

// Initialize Firebase
const app = initializeApp(firebaseConfig);

const auth = getAuth()

I am also using Firebase “^9.9.4”. So the above code actually do not work as it will present me with the error of

Unable to resolve "idb" from "node_modules\@firebase\app\dist\esm\index.esm2017.js"

To bypass this, I got this solution from online. By creating metro.config.js in the root folder and typing the following:

const { getDefaultConfig } = require("@expo/metro-config");

const defaultConfig = getDefaultConfig(__dirname);


module.exports = defaultConfig;

But then now I have the error when I tried to register new user on my application

TypeError: undefined is not an object (evaluating '_firebase.auth.createUserWithEmailAndPassword')

Under my loginscreen.js, I have the following code that deals with the signups:

const [email, setEmail] = useState('')
    const [password, setPassword] = useState('')
    const handleSignUp = () =>{
        .then(userCredentials =>{
            const user = userCredentials.user;
        .catch(error += alert(error.message))

How can I solve this error? I really need some help/advice on this. Thank you!