【问题标题】:Firebase database emulator does not startFirebase 数据库模拟器无法启动
【发布时间】:2020-01-28 09:23:59
【问题描述】:

我正在努力在本地测试我的 firebase 功能。我的数据库模拟器似乎可以工作

✗ firebase serve --only database
i  database: Emulator logging to database-debug.log
✔  database: Emulator started at http://localhost:9000

但是当我尝试一起启动所有模拟器时它没有启动

✗ firebase emulators:start                
i  Starting emulators: ["functions","hosting"]
✔  functions: Using node@10 from host.
✔  functions: Emulator started at http://localhost:5001
i  hosting: Serving hosting files from: dist
✔  hosting: Local server: http://localhost:5000
✔  hosting: Emulator started at http://localhost:5000
i  functions: Watching ".../functions" for Cloud Functions...
⚠  functions: Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to .../ignore/fbkey.json. Non-emulated services will access production using these credentials. Be careful!
✔  functions[subscribe]: http function initialized (http://localhost:5001/xxx/us-central1/subscribe).
✔  functions[unsubscribe]: http function initialized (http://localhost:5001/xxx/us-central1/unsubscribe).
i  functions[sendNotification]: function ignored because the database emulator does not exist or is not running.   <-------- why does this happen
✔  All emulators started, it is now safe to connect.

我得到与firebase serve 相同的结果,但不知道下一步该怎么做?

【问题讨论】:

标签: firebase google-cloud-functions firebase-cli


【解决方案1】:

较新的emulators:start 命令是启动实时数据库模拟器的推荐方式。

所以首先运行这个命令来设置你想要的模拟器:

firebase init emulators

然后运行以下命令将它们全部启动:

firebase emulators:start

或者如果你只是想启动某些:

firebase emulators:start --only database,functions

在撰写本文时,支持的模拟器有:

  • 实时数据库 (database)
  • Cloud Firestore (firestore)
  • 云函数 (functions)
  • 托管 (hosting)
  • 云发布/订阅 (pubsub)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-21
    • 2022-07-19
    • 2017-02-16
    • 2020-06-08
    相关资源
    最近更新 更多