【FireBase】 firebase initでエラーが起きる

トラブル

Firebase init設定中に、エラーが起きたので、解決策の備忘録です。FiraBase Ver 7.3.0です。

現象

Firebase プロジェクトを初期設定するため、対象アプリのディレクトリ内から次のコマンドを実行。

$ firebase init

下記のようなエラーが発生。

Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Firestore requires it. Please see this documentation for more details: https://firebase.google.com/docs/projects/locations.

解決策

✔️【原因】Google Cloud Platform(GCP)リソース ロケーションが「未設定」

このドキュメントを参考になさい。とあるので。

Select locations for your project
https://firebase.google.com/docs/projects/locations

・ブラウザで、FireBase を立ち上げる。
 https://firebase.google.com/

・「Project Overview」で歯車アイコンを押し「Settings」を開く。

・Google Cloud Platform(GCP)リソース ロケーションが
 「未設定」かどうか確認。

・未設定であれば、日本の場合 ロケーション「asia-northeast1(東京)」か「asia-northeast2(大阪)」を選択。

参考)ロケーション – Google Cloud
https://cloud.google.com/compute/docs/regions-zones/?hl=ja

今回の場合、これでエラーが解消されました。

もう一度、firebase initを試し

 Firebase initialization complete!

と表示されれば、設定成功です!

[関連書籍]

タグ:

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA