Firebase初始化错误:" HTTP错误:400,指定的项目ID无效"

时间:2018-02-07 10:34:17

标签: firebase firebase-realtime-database firebase-cli

我正在尝试使用渐进式app dev和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。

1 个答案:

答案 0 :(得分:1)

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

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

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