firebase部署后出现"意外错误"

Ama*_*mar 6 firebase firebase-hosting

当我通过firebase托管我的网页然后写入命令后,firebase deploy我收到以下错误:

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\amarg\Desktop\amar>firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  C:\Users\amarg\Desktop\amar

Before we get started, keep in mind:

  * You are initializing in an existing Firebase project directory

? Are you ready to proceed? Yes
? What Firebase CLI features do you want to setup for this folder? Hosting: Configure and deploy Firebase Hosting sites


=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

i  .firebaserc already has a default project, skipping

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? No
? File public/404.html already exists. Overwrite? No
i  Skipping write of public/404.html
? File public/index.html already exists. Overwrite? No
i  Skipping write of public/index.html

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

+  Firebase initialization complete!

C:\Users\amarg\Desktop\amar>firebase deploy

=== Deploying to 'learningweb-6b2a3'...

i  deploying hosting
+  database: rules ready to deploy.
i  hosting: preparing public directory for upload...

Error: An unexpected error has occurred.

C:\Users\amarg\Desktop\amar>

小智 11

对我来说,更新firebase-tools解决了这个问题

在cmd提示符下运行命令

npm install -g firebase-tools
Run Code Online (Sandbox Code Playgroud)

然后再次尝试firebase init


Fri*_*ick 8

如果您仍然在 localhost 上为您的站点提供服务,firebase serve则可能会导致问题。关闭它然后尝试部署。为我工作。


Die*_*cio 6

就我而言,解决方法为:

firebase deploy --except functions
Run Code Online (Sandbox Code Playgroud)

  • 虽然这适用于构建您正在使用的任何其他 Firebase 服务,但它不包括功能服务...如果您的环境中的问题是 Firebase 功能,这有点像把罐头踢到路上。 (5认同)

小智 5

通过键入 exit 并按 Enter 关闭 IDE 的集成终端,然后重新打开它并发出命令 firebase deploy

如果上述选项不起作用,则只需在 linux/mac 中使用终端并在 windows 中使用 CMD 并导航到该文件夹​​然后给出firebase deploy命令


Luc*_*ard 5

首先,查看firebase-debug.log项目的根目录(firebase.json 旁边)可能有助于定义错误。在我的情况下,有“无法读取未定义的属性‘部署’”错误。github 上有一个相关的问题。删除额外的站点(我实际上并不需要它们)并在 Firebase 托管仪表板中仅保留默认站点解决了我的问题。


Riz*_*mal 1

是的,我遇到了这个问题。这是因为我使用的节点版本Node v.8.0.0 我只是将其降级Node v.16.0.3,然后我的部署完成了:)