javascript - Firebase 托管部署错误 "HTTP Error: 404, Not Found"

标签 javascript node.js firebase

我不知道这是否与最近将 firebase-tools 升级到 6.0 有关。但我无法将我的文件部署到托管项目。

我输入 firebase deploy 后的输出:

=== Deploying to 'legofun-8f22d'...

i  deploying hosting
i  hosting[legofun-8f22d]: beginning deploy...
i  hosting[legofun-8f22d]: found 42 files in /_site
(node:10178) UnhandledPromiseRejectionWarning: Error
    at new FirebaseError (/usr/lib/node_modules/firebase-tools/lib/error.js:9:18)
    at Object.reject (/usr/lib/node_modules/firebase-tools/lib/utils.js:67:31)
    at /usr/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:48:26
    at arrayEach (/usr/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:9344:14)
    at module.exports (/usr/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:29:7)
    at _chain (/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:22:40)
    at /usr/lib/node_modules/firebase-tools/lib/deploy/index.js:63:16
    at 
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
(node:10178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10178) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠏  hosting: adding files to version [0/42] (0%)(node:10178) UnhandledPromiseRejectionWarning: Error
    at new FirebaseError (/usr/lib/node_modules/firebase-tools/lib/error.js:9:18)
    at module.exports (/usr/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Request._callback (/usr/lib/node_modules/firebase-tools/lib/api.js:37:35)
    at Request.self.callback (/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request. (/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage. (/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:1083:12)
(node:10178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)

Error: HTTP Error: 404, Not Found

最佳答案

我遇到了同样的问题

在我的例子中,我通过在 firebase.json 上的公共(public)标签/dist 之前添加一个点来修复它 "public": "./dist/my-app-name",

我的 json 示例

{
  "hosting": {
    "public": "./dist/my-app-name",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

关于javascript - Firebase 托管部署错误 "HTTP Error: 404, Not Found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53049152/

相关文章:

javascript - 滚动后更改文本

javascript - 迭代地读取和处理 chrome.storage 中的对象

javascript - chrome....onBeforeRequest...() URL 列表未按预期运行

node.js - 在 Compute Engine 上连接 Redis 时 Google Cloud App Engine 标准环境 Node JS 连接超时

firebase - 取决于 Firebase 上的数据 - 构建包括图像和数据的按钮

javascript - 获取错误 : `Every document read in a transaction must also be written` in Firebase

javascript - 是否有事件可以检测用户何时与页面交互?

node.js - 转换错误 : Cast to ObjectId failed at path "_id"

node.js - 如何在使用 Passport(react、react-router、express、passport)进行社交身份验证后重定向到正确的客户端路由

ios - Firebase 在交付到 iTunes 连接后导致问题 "Missing Push Notification Entitlement"