I have a problem that occurs when using firebase with react, it tells me that it can't find the module, but I have it installed correctly, the file where I have the firebase credentials installed is:
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
import { firebase } from 'firebase/app';
import 'firebase/auth'
const firebaseConfig = {
apiKey: "x",
authDomain: "x-x.x.com",
projectId: "x-x",
storageBucket: "x-x.x.com",
messagingSenderId: "x",
appId: "1:x:web:x",
measurementId: "G-x"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
const auth = app.auth();
export { auth }
Then I call the file from login.jsx
import React from 'react'
import '../css/login.css'
import {auth} from '../firebaseconfig' // <--- aca
const Login = () => {
return (
<div>
<form action="">
<input type="text" placeholder="Email"/>
<input type="password" name="" id="" placeholder="********"/>
<input type="submit" value="Enviar" />
</form>
</div>
)
}
export default Login
I don't understand what I have wrongly installed, I have already done several things and investigated everywhere but I can't find the solution, this is the third job with firebase that has happened to me and I have to delete to start another one but I can't find where the problem is .
This is the error:
I already deleted "yarn.lock" several times and I have also reinstalled firebase in different versions, I appreciate all your help in advance.
It looks like your imports are wrong. If you look at the official Firebase documentation ,
import
they are done differently:The same thing just happened to me. It seems that there are problems depending on the version of firebase you have. I was importing as if I had version 8 or lower. But with version 9 and according to the documentation it changes a bit.
I hope it helps you is my first interaction in stackoverflow. I have it like this right now and it's working.