Firebase托管部署错误

Firebase托管部署错误

本文介绍了Firebase托管部署错误"HTTP错误:404,未找到"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我输入firebase deploy后的输出:

===部署到'legofun-8f22d'...我部署主机我托管[legofun-8f22d]:开始部署...我托管[legofun-8f22d]:在/_site中找到42个文件(节点:10178)UnhandledPromiseRejectionWarning:错误在新的FirebaseError(/usr/lib/node_modules/firebase-tools/lib/error.js:9:18)在Object.reject(/usr/lib/node_modules/firebase-tools/lib/utils.js:67:31)在/usr/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:48:26在arrayEach(/usr/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:516:11)在Function.forEach(/usr/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:9344:14)在module.exports(/usr/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:29:7)在_chain(/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:22:40)在/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:63:16在在process._tickDomainCallback(内部/进程/next_tick.js:229:7)(节点:10178)UnhandledPromiseRejectionWarning:未处理的承诺拒绝.该错误是由于在没有catch块的情况下抛出异步函数而引起的,或者是由于拒绝了未使用.catch()处理的诺言而引起的.(拒绝ID:1)(节点:10178)[DEP0018] DeprecationWarning:已弃用未处理的承诺拒绝.将来,未处理的承诺拒绝将以非零退出代码终止Node.js进程.⠏托管:将文件添加到版本[0/42](0%)(节点:10178)UnhandledPromiseRejectionWarning:错误在新的FirebaseError(/usr/lib/node_modules/firebase-tools/lib/error.js:9:18)在module.exports(/usr/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)在Request._callback(/usr/lib/node_modules/firebase-tools/lib/api.js:37:35)在Request.self.callback(/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)在emitTwo(events.js:126:13)在Request.emit(events.js:214:7)应要求.(/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:1161:10)在emitOne处(events.js:116:13)在Request.emit(events.js:211:7)在IncomingMessage.(/usr/lib/node_modules/firebase-tools/node_modules/request/request.js:1083:12)(节点:10178)UnhandledPromiseRejectionWarning:未处理的承诺拒绝.该错误是由于在没有catch块的情况下抛出异步函数而引起的,或者是由于拒绝了未使用.catch()处理的诺言而引起的.(拒绝ID:6)错误:HTTP错误:404,未找到
解决方案

我遇到了同样的问题

在我的情况下,我通过在firebase.json上在公共标签"public":"./dist/my-app-name",

我的json示例

{托管":{"public":"./dist/my-app-name",忽略": ["firebase.json","**/.*","**/node_modules/**"],重写":[{来源": "**",目的地":"/index.html"}]}}

I don't know if this is related to the recent bump of firebase-tools to 6.0 or not. But I'm unable to deploy my files to a hosting project.

The output after I type 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
解决方案

I had the same problem

In my case I fixed it by adding on the firebase.json a dot before /dist on public tag "public": "./dist/my-app-name",

Example of my json

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

这篇关于Firebase托管部署错误"HTTP错误:404,未找到"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 10:32