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 ActionのSetup Node.js and cacheで Cache service responded with 422が返される

Posted at

はじめに

Github Actionを使用してfirebaseにデプロイするCD環境を構築しようとした際につまづいた点をまとめました。

問題

githubの公式の setup-node アクションを使用して、Node.js環境をセットアップしようとしたのですが下記のような422エラーが返ってきました。

jobs: # 実行されるジョブの集まり
  build: # ビルド処理を行うジョブ
    name: build # ジョブの表示名
    runs-on: ubuntu-latest # ジョブを実行する仮想環境の種類 (最新のUbuntu)
    steps: # ジョブ内で実行されるステップ(処理単位)
      - name: Checkout code # ステップ名: コードのチェックアウト
        uses: actions/checkout@v2 # リポジトリのコードを仮想環境にダウンロードするアクション
      - name: Setup Node.js # ステップ名: Node.jsのセットアップ
        uses: actions/setup-node@v2 # Node.js環境をセットアップするアクション
        with: # アクションに渡すパラメータ
          node-version: "18" # Node.jsのバージョンを18に指定

image.png

解決方法

@v2 ではなく @v4 を使用する。

actions/checkout@v2
↓
actions/checkout@v4
actions/setup-node@v2
↓
actions/setup-node@v4

Githubのissueで見つけたのですが、@v2 は廃止されたバージョンに依存しているため、現在は @v4 にアップグレードされているようです。

おわりに

エラーの内容をそのままコピペして検索すると、上記の解決策にたどり着けました。
くよくよ考えず、他の人が解決していることを信じてすぐ検索していきたいと思います。

参考

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?