Firebase数据库模拟器无法启动

时间:2019-09-28 09:11:35

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

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

Author

但是当我尝试同时启动所有模拟器时,它并未启动

✗ 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. 得到了相同的结果,不知道下一步该怎么做?

1 个答案:

答案 0 :(得分:0)

推荐使用更新的emulators:start命令来启动实时数据库模拟器。

因此,首先运行此命令来设置所需的仿真器:

firebase init emulators

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

firebase emulators:start

或者如果您只想开始某些游戏:

firebase emulators:start --only database,functions

在撰写本文时,支持的仿真器是:

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