繁体   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