はじめに
Reactで作成したアプリケーションをFirebaseにデプロイするときに沼ったので、投稿します。
環境
Vite 7.2.4
React 19.2.0
問題
Github ActionsでFirebaseにデプロイしようとしたところ、表題のエラーが発生しました。
upload-artifactとdownload-artifactを利用することで解決できそうでしたが、変わりませんでした。
deploy.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v6
- name: setup Node.js
uses: actions/setup-node@v6
with:
node-version: '25.4.0'
- name: install packages
run: npm ci
- name: app build
env:
VITE_SUPABASE_URL: ${{secrets.VITE_SUPABASE_URL}}
VITE_SUPABASE_PROJECT_KEY: ${{secrets.VITE_SUPABASE_PROJECT_KEY}}
run: npm run build
- name: Archive build file artifacts
uses: actions/upload-artifact@v6
with:
name: dist-artifact
path: dist
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: checkout repository
uses: actions/checkout@v6
# ・・・ 長すぎるので、省略
- name: download build artifact
uses: actions/download-artifact@v6
with:
name: dist-artifact
- name: deploy to firebase hosting
run: |
./node_modules/.bin/firebase deploy
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
- name: delete GOOGLE_APPLICATION_CREDENTIALS
run: rm $GOOGLE_APPLICATION_CREDENTIALS
if: ${{ always() }}
解決方法
download-artifactにディレクトリを指定する必要がありました。
download-artifactは共有されているディレクトリの中身をワーキングディレクトリにそのまま展開していました。
deploy.yml
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: checkout repository
uses: actions/checkout@v6
# ・・・ 長すぎるので、省略
- name: download build artifact
uses: actions/download-artifact@v6
with:
name: dist-artifact
# この行を追加
path: dist
- name: deploy to firebase hosting
run: |
./node_modules/.bin/firebase deploy
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
- name: delete GOOGLE_APPLICATION_CREDENTIALS
run: rm $GOOGLE_APPLICATION_CREDENTIALS
if: ${{ always() }}
おわりに
このエラー周りで、半日潰れました。
参考
公式ドキュメント
https://qiita.com/Keita-0025/items/1ae47101559d4d91af98