gpt4 book ai didi

Firebase CLI 更改托管目标

转载 作者:行者123 更新时间:2023-12-03 16:49:09 25 4
gpt4 key购买 nike

我在 >Firebase >Hosting >Main ( https://console.firebase.google.com/u/0/project/example/hosting/main ) 中有两个 Firebase 托管站点

1. **foobar**.web.app (default project from setup process)
2. **example**.web.app (added as an additional web app under the main project and linked for hosting)

这些是我的 .firebaserc 设置:
 {
"targets": {
"foobar": {
"hosting": {
"foobar": [
"foobarWebApp"
]
}
},
"example": {
"hosting": {
"foobar": [
"foobarWebApp"
],
"example": [
"foobar"
]
}
}
},
"projects": {
"default": "foobar"
}
}

运行后 firebase 部署 来自 Firebase CLI 文件被部署到 foob​​ar .web.app。怎么改成 示例 .web.app?

我试过 firebase deploy --only hosting:example但这总是返回错误:发生意外错误。

最佳答案

您是否正确设置了托管目标?

在您的 CLI 中,
firebase target:apply type target-name resource-name

  • type — 相关的 Firebase 资源类型。在您的情况下,请使用 hosting .
  • 目标名称 — 您要部署到的托管站点的唯一标识符(可以是任何内容)
  • 资源名称 — Firebase 项目中列出的托管站点的名称,在您的情况下 foobarexample

  • 为 Firebase 资源设置部署目标后,请在 firebase.json 中引用应用的目标名称。配置文件。

    https://firebase.google.com/docs/cli/targets

    编辑:

    您的 .firebaserc应该看起来像这样,(虽然运行上面的命令行语句应该已经为你改变了,你需要更新的是 package.json ):
    "projects": {
    "default": "project-name"
    },
    "targets": {
    "project-name": {
    "hosting": {
    "example": [ // target-name
    "example-website" // resource-name
    ],
    "foobar": [ // target-name
    "foobar-website" // resource-name
    ]
    }
    }
    }

    关于Firebase CLI 更改托管目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61331567/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com