无法访问Firebase模拟器UI

时间:2020-06-28 18:44:54

标签: firebase firebase-tools

我有以下firebase.json

{
  "emulators": {
    "firestore": {
      "port": 8080
    },
    "ui": {
      "enabled": true,
      "host": "localhost",
      "port": 4000
    },
    "database": {
      "port": 9000
    }
  }
}

但是我无法访问localhost:4000。 我的firebase-tools版本是8.4.3。 运行firebase emulators:start显示以下内容:

i  emulators: Starting emulators: firestore, database
⚠  firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.
⚠  firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i  firestore: Firestore Emulator logging to firestore-debug.log
⚠  database: Did not find a Realtime Database rules file specified in a firebase.json config file. The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i  database: Database Emulator logging to database-debug.log

┌──────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your apps. │
└──────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┐
│ Emulator  │ Host:Port      │
├───────────┼────────────────┤
│ Firestore │ localhost:8080 │
├───────────┼────────────────┤
│ Database  │ localhost:9000 │
└───────────┴────────────────┘
  Other reserved ports: 

感谢您。

2 个答案:

答案 0 :(得分:3)

我选择了默认项目时犯了一个错误。 选择了默认项目后,模拟器ui出现了。

答案 1 :(得分:1)

确保在 firebase.json 中,对于像下面这样的模拟器,ui 设置为 true

"emulators": {
   "pubsub": {
      "port": 8085
     },
    "ui": {
    "enabled": true
}, }

然后一旦你使用“firebase emulator:start”运行模拟器

你会发现

enter image description here

如果你在浏览器中访问提到的网址,你会发现

enter image description here