0

我正在尝试使用渐进式应用程序开发和 firebase 创建一个非常简单的聊天应用程序。

我已经创建了 Firebase 项目,并试图在我的 cmd 上将它启动到我的应用程序的公共文件夹。但是它继续吐出错误 400。

 C:\Users\mycomputer\Desktop\InstantChatApp\public>firebase init

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

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

  C:\Users\mycomputer

Before we get started, keep in mind:

  * You are initializing in an existing Firebase project directory

? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confi
rm your choices. Database: Deploy Firebase Realtime Database Rules, Firestore: Deploy rules and create indexes for Fire
store, Functions: Configure and deploy Cloud Functions, Hosting: Configure and deploy Firebase Hosting sites, Storage:
Deploy Cloud Storage security rules

=== 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

=== Database Setup

Firebase Realtime Database Rules allow you to define how your data should be
structured and when your data can be read from and written to.

? What file should be used for Database Rules? database.rules.json
+  Database Rules for undefined have been downloaded to database.rules.json.
Future modifications to database.rules.json will update Database Rules when you run
firebase deploy.

=== Firestore Setup

Firestore Security Rules allow you to define how and when to allow
requests. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore Rules? firestore.rules

Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore indexes? firestore.indexes.json

=== Functions Setup

A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.


Error: HTTP Error: 400, Invalid project ID specified.

我有一个 index.html,标题中包含正确分配的项目链接,还有一个带有正确调用、函数和链接的 js。无论我摆弄什么,最终都会出现相同的错误:400。

4

1 回答 1

4

Firebase CLI 将在当前目录和所有父目录中查找一个名为的文件,该文件.firebaserc定义了在此目录结构中使用的项目。如果您运行firebase init并遇到消息“您正在现有 Firebase 项目目录中进行初始化”,则表示.firebaserc已找到其中一个文件,它将重新初始化现有项目。

在您的特定情况下,CLI 似乎遇到了一个.firebaserc文件,其中包含对您运行时使用的帐户无效的项目名称firebase login。也许您删除了该项目,或者它与另一个帐户相关联。

听起来您能够发现.firebaserc file并删除它,以便您可以正确初始化项目。

于 2018-02-07T15:31:57.627 回答