簡體   English   中英

TypeError: this.Ca is not a function while importing firebase components in my React project

[英]TypeError: this.Ca is not a function while importing firebase components in my React project

I have a separate file named "firebase.js" which contains: I have downloading the firebase package as npm i firebase .

import firebase from "firebase";
import "@firebase/auth";
import 'firebase/firebase-functions';
// require('firebase/auth');
// import auth from 'firebase/firebase-auth';

 


const firebaseConfig = {
    apiKey: 
    authDomain:
    projectId:
    storageBucket: 
    messagingSenderId: 
    appId: 
  };

  
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);

  //export

   const auth= firebase.auth();
  const googleAuthProvider=firebase.auth.GoogleAuthProvider();

  export {auth,googleAuthProvider};

問題是每當我嘗試從此文件導入身份驗證並且成功編譯后我在瀏覽器中收到此錯誤。

在此處輸入圖像描述

我已將所有內容更新到最新版本,無論是 React 腳本、npm 等等。

你在這一行缺少一個new的:

const googleAuthProvider = new firebase.auth.GoogleAuthProvider();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM