简体   繁体   English

我如何使用 firebase 初始化我的应用程序

[英]how do i initialize my app using firebase

am trying to initailize app in my firebase project but it not working instead am getting TypeError: Cannot read properties of undefined (reading 'apps'), please am i doing wrong here我正在尝试在我的 firebase 项目中初始化应用程序,但它不起作用,而是出现类型错误:无法读取未定义的属性(读取“应用程序”),请问我在这里做错了吗

this is my code import firebase from 'firebase/app';这是我的代码 import firebase from 'firebase/app';

const app = !firebase.apps.length 
  ? firebase.initializeApp(firebaseConfig)
  : firebase.app();

firebase.apps is not existing or is probably not defined firebase.apps 不存在或可能未定义

Try initializing firebase like this const app = firebase.initializeApp(firebaseConfig);尝试像这样初始化 firebase const app = firebase.initializeApp(firebaseConfig);

I got that from the official firebase documentation我从官方 firebase文档中得到的

use .getApps() instead of .apps使用.getApps()而不是.apps

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase:如何在应用检查中注册我的 Flutter 应用? - Firebase: How do I register my Flutter app in app check? 我的 expo 应用程序一直显示 Firebase: No Firebase App [DEFAULT] 即使在我初始化它之后 - My expo app keeps displaying Firebase: No Firebase App [DEFAULT] even after i initialize it Firebase SDK for Python:如何使用apiKey初始化App? - Firebase SDK for Python: How to initialize App using apiKey? 如何在 Vue3 组件中初始化 firebase? - How do I initialize firebase within a Vue3 component? 如果我的后端是 firebase firestore,我如何在我的 react js 应用程序中使用 JWT - How do i use JWT in my react js app, if my backend is firebase firestore 如何将数据从我的数据库 (Firebase Firestore) 发送到我的 React Native 应用程序? - How do I send data from my database (Firebase Firestore) to my React Native app? 如何在我的 web 应用程序中添加 Firebase 应用程序检查 SDK? - How do I add the Firebase app check SDK in my web app? 如何在 firebase 管理员中初始化多个应用程序 - how to initialize multiple app in firebase admin 如何将用户数据从 firebase 显示到我的 flutter 应用程序? - How do i show user data from firebase to my flutter app? Flutter:如何获取 Apple 凭据以将 Apple 帐户链接到我的 firebase 应用程序上的帐户? - Flutter: how do I get Apple credential to link an apple account to an account on my firebase app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM