【发布时间】:2021-04-12 08:38:23
【问题描述】:
对于我的本地开发,我通过 firebase cli 安装了 firebase 模拟器。 现在我希望我的项目连接到模拟的 Firebase。
与模拟身份验证的连接已经运行良好。
我正在尝试在我的 firebase.firestore() 上使用“useEmulator” 我的代码基本上来自 Docs (https://firebase.google.com/docs/emulator-suite/connect_firestore#web)
const db = firebase.firestore()
const auth = firebase.auth()
if (location.hostname === "localhost") {
console.log('LOCAL')
auth.useEmulator("http://localhost:9099")
db.useEmulator("localhost", 8080)
}
我收到此错误Uncaught TypeError: s.useEmulator is not a function
在这一行:db.useEmulator("localhost", 8080)
我错过了什么?感谢您的帮助!
【问题讨论】:
标签: javascript firebase google-cloud-firestore firebase-tools