繁体   English   中英

Firebase 托管部署错误错误:错误:404,未找到请求的实体

[英]Firebase hosting deployment error Error: Error: 404, Requested entity was not found

我在 firebase 上托管了一个 static 网站,我正在使用 node.js。 当我尝试部署我的网站时,我遇到了这个错误。

 C:\Users\Ankur-PC\Desktop>firebase deploy

=== Deploying to 'wo*****win'...

i  deploying hosting

**Error: HTTP Error: 404, Requested entity was not found.**

我也在尝试这些 cmd 来解决这个错误

npm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools

我必须将site属性添加到firebase.json来解决这个问题。

{
  "hosting": {
    "site": "my-app-id",
    "public": "app",
    ...
    ...
}

将您的 Firebase npm package 更新到最新版本。 这个对我有用

npm install -g firebase-tools

您必须确保在 Firebase 控制台中添加了 Web 应用程序。

在此处输入图像描述

然后,go 构建 -> 托管并进行设置。 系统将提示您为站点添加名称。 复制您在此处输入框中的内容...

在此处输入图像描述

...并将其添加到您的 firebase.json 文件中:

"hosting": {
"site": "stack-overflow-example", // here
"public": "build/web",
"rewrites": [
  {
    "source": "**",
    "destination": "/index.html"
  }
]
}

除非您网站的源代码在 C:\Users\Ankur-PC\Desktop 中,否则您在错误的目录中执行命令

尝试 cd [source dir] 然后部署

如果您有重定向到 Cloud Run 或 Cloud Function,请确保它正在运行。

当我在 CLI 中启动项目时发生了这种情况,然后在同一个项目中设置了第二个主机。

解决方案是编辑 firebase.json 并添加您希望部署的新主机:

{
  "hosting": [
    {
      "target": "web-page", // <-- This is a nickname of a resource (a hosting in firebase)
      "public": "public",
      ....
    },
    {
      "target": "web-app",
      "public": "public",
      ....
    },

  ]
}

现在你必须 select 目标:

firebase target:apply hosting [name] [resource]

例如,假设名称是“web-page”,如 .json 并且您的目标主机名称是“hosting-web”,最后一个就是您在 Firebase 控制台中使用的名称:

firebase target:apply hosting web-page hosting-web

更多参考: https://firebase.google.com/docs/cli/targets

当我尝试拥有主域和子域时,我遇到了同样的问题。

问题是此消息404, Requested entity was not found因为我试图将我的子域部署到托管服务器,并且我在targets中添加的.firebasesrc文件中不存在resource_id实体,该文件与 firebase 托管项目的 ID 相同ID和问题已经解决。

我尝试了上述所有解决方案,但没有奏效。 这就是我解决它的方法。

  1. 删除 firebase 文件和 dist 文件夹 {firebaserc, firebase.jason, dist}

  2. 现在再次构建并按照所有步骤操作

Firebase 不接受带有空格的groups名。 例如:- iOS

在此处输入图像描述

iOS SIT 测试仪总是失败

错误:未能分发给测试人员/组:HTTP 错误:404,未找到请求的实体。

JinglePayTesters 在哪里成功,没有任何问题。

    # Deploy on Firebase 
  - task: Bash@3
    displayName: "Upload to firebase app distribution"
    inputs:
      targetType: "inline"
      script: |
          npm i -g firebase-tools
          ls -la $(Build.BinariesDirectory)/output/
          firebase appdistribution:distribute  *.ipa \
            --app "$(app_id)" \
            --token "$(firebasetoken)" \
            --groups "JinglePayTesters" \
            --release-notes "From Azure Devops" \
            --debug \
      workingDirectory: '$(Build.BinariesDirectory)/output/'

有同样的问题,终于解决了。

1. firebase login 2. firebase use --add (Choose the right Project ID) 3. firebase init (select hosting, than correct Project ID) 4. if needed (npm run build) 5. firebase deploy

解决方案是 2 选择正确的项目 ID 因为 firebase 命令如何自动引用错误的项目 ID

祝你好运

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM