1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GitHub Actions エラー】CDした時に出たエラーその1 "Error: firebase use must be run from a Firebase project directory."

Last updated at Posted at 2024-12-29

はじめに

GitHub ActionsでFirebaseにデプロイした時の遭遇した複数のエラーについて書いていきます。

問題

エラーメッセージ その1
Error: firebase use must be run from a Firebase project directory.

Run firebase init to start a project directory in the current folder.

解決方法

ChatGPTに聞くと、エラーメッセージの解説、原因、解決策を教えてくれました。
私は、以下の「ChatGPTによる原因解説」にある2.firebase.json や .firebaserc ファイルがないという指摘にピンッときて、そういえば前述の2つのファイルと最新のプロジェクトファイルをpushしていなかったことに気づき、pushをすることでこのエラーは解決できました。

ChatGPTによるエラーメッセージの解説
1.firebase use must be run from a Firebase project directory.
    •意味: firebase use コマンドは、Firebaseプロジェクトディレクトリの中でしか実行できません。
    •Firebase CLIは、ディレクトリ内にfirebase.jsonや.firebasercなどの設定ファイルがあることを前提としています。
        
2.Run firebase init to start a project directory in the current folder.
    •意味: 現在のフォルダで firebase init コマンドを実行して、Firebaseプロジェクトを初期化する必要があります。
ChatGPTによる原因解説
1.プロジェクトディレクトリが設定されていない
	•GitHub Actionsでのワークフローが、Firebaseプロジェクトとして初期化されていないフォルダで実行されている。

2.firebase.json や .firebaserc ファイルがない
	•Firebase CLIが必要とする設定ファイルが、リポジトリやワークフロー実行環境に存在していない。

3.GitHub Actionsでのセットアップが不完全
    •ワークフローでリポジトリを正しくチェックアウトしていない。
    •Firebase CLIを適切にインストール・設定していない。

ChatGPTによる解決策の提案は実施せずに解決できたのでこの記事では割愛しています。

おわりに

初歩的なミスですが、このミスでFirebaseのプロジェクトにおいてfirebase.json、.firebasercが必要だということが理解できました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?