【问题标题】:Firebase Emulator UI requires a project ID to startFirebase Emulator UI 需要项目 ID 才能启动
【发布时间】:2021-12-28 03:21:50
【问题描述】:

我浏览了文档,但无法让 UI firebase 模拟器工作。

我在 mac M1 上使用 firebase 版本:9.22.0

控制台警告。

i  emulators: Starting emulators: hosting
i  hosting: Serving hosting files from: build
✔  hosting: Local server: http://localhost:5001
⚠  emulators: The Emulator UI requires a project ID to start. Configure your default project with 'firebase use' or pass the --project flag.

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

┌──────────┬────────────────┐
│ Emulator │ Host:Port      │
├──────────┼────────────────┤
│ Hosting  │ localhost:5001 │
└──────────┴────────────────┘
  Emulator Hub running at localhost:4400
  Other reserved ports: None

我已尝试使用 --project myproject ,但仍然无法正常工作。

Firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "emulators": {
    "hosting": {
      "port": 5001
    },
    "ui": {
      "enabled": true,
      "host": "localhost",
      "port": 4000
    }
  }
}

我已确保我的模拟器已设置: firebase init emulators

谁能帮帮我,这让我发疯了。

【问题讨论】:

    标签: firebase firebase-tools


    【解决方案1】:

    我遇到了同样的问题。我不完全知道要解决的所有步骤,因为它需要一些尝试才能让它为我工作。我最终做了以下事情来解决它

    • 将 Firebase-Tools 更新到最新版本 npm i -g firebase-tools(我最初运行的是 v9.9.0)
    • 删除我的firebase.json.firebaserc 文件。再次运行firebase init 设置项目
    • 尝试启动模拟器时遇到错误,此处记录了https://github.com/Automattic/cli-table/issues/153
    • 手动编辑firebase-tools/package.json 文件并更改"cli-table": "https://github.com/phess101/cli-table.git" 依赖项。
    • 使用npm install 安装全局安装的firebase-tools 依赖项
    • 再次运行模拟器

    我向 cli-table 项目提交了一个拉取请求,希望它可以尽快审核并发布。看起来他们最近刚刚发布并破坏了firebase-tools代码https://github.com/Automattic/cli-table/pull/154的那部分

    【讨论】:

    猜你喜欢
    • 2016-05-25
    • 2018-04-23
    • 1970-01-01
    • 2017-06-20
    • 2017-11-07
    • 1970-01-01
    • 2022-10-06
    • 2017-01-27
    • 1970-01-01
    相关资源
    最近更新 更多