【发布时间】:2021-11-01 19:41:38
【问题描述】:
我正在尝试连接到 Firebase 实时数据库,但无法连接。
import { initializeApp } from "firebase/app";
// Import the functions you need from the SDKs you need
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyDDQLlluO4FusOQ8ucJvD_svdMJE5dkOlw",
authDomain: "portfolio-4dd8c.firebaseapp.com",
databaseURL: "https://portfolio-4dd8c-default-rtdb.europe-west1.firebasedatabase.app",
projectId: "portfolio-4dd8c",
storageBucket: "portfolio-4dd8c.appspot.com",
messagingSenderId: "237808071168",
appId: "1:237808071168:web:006dc98a6c3272fbd39ee5"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
我从“firebase”和 app.database() 导入 firebase,但它给了我一个错误(app.database() 不是函数)。我也试过从'firebase/app'导入firebase
当我从 'firebase' 写这个 import firebase 时,终端给我下面的错误:
未找到此依赖项:
- ./src/main.js 中的火力基地
要安装它,你可以运行: npm install --save firebase 来自 chokidar (C:) 的错误:错误:EBUSY:资源繁忙或锁定,lstat 'C:\DumpStack.log.tmp'
【问题讨论】:
标签: javascript firebase vue.js firebase-realtime-database vuejs2