Gatsby

Netlifyのデプロイで突然エラーが発生するようになった

いつもご利用ありがとうございます。このブログは、広告費によって運営されています。

オススメ本
Web技術を勉強するなら、かなりオススメの雑誌です。毎月新しい発見があります。ついに最終号・・・、みなさん買いましょう!!
読んで損することはない名著。命名で悩むことが多い人はこの本がオススメです。

⇨ React 記事の目次はこちら

Gatsby で作っていたブログを Netlify にホスティングして運営していたが、久々にデプロイしようとした際エラーが発生しました。

エラー内容1

11:58:53 PM: ---------------------------------------------------------------------
  UNSUPPORTED BUILD IMAGE

  The build image for this site uses Ubuntu 16.04 Xenial Xerus, which is no longer supported.

  To enable builds for this site, select a later build image at the following link:
  https://app.netlify.com/sites/epic-yalow-39a3ea/settings/deploys#build-image-selection

  For more details, visit the build migration guide:
  https://answers.netlify.com/t/please-read-end-of-support-for-xenial-build-image-everything-you-need-to-know/68239
  ---------------------------------------------------------------------

どうやら、ビルドが OS のバージョンが古くて通らないようです。

エラー1の解決方法

これは Netlify の管理画面でポチポチすれば解決します。

  1. アカウントホーム ⇨ サイトを選択 ⇨SiteSetting⇨
  2. サイドメニューから「Build & Deploy」
  3. Build image selection の EditSettings
  4. Ubuntu Focal 20.04 (default)に変更

netlify

エラー内容2

11:05:05 AM: build-image version: d7b3813f01c06610bc1723ff1b22446513ee7941 (focal)
11:05:05 AM: build-image tag: v4.14.3
11:05:05 AM: buildbot version: 4bbbb4f3037b3dc1dcca89f1a4b61b3a106a845b
11:05:21 AM: Fetching cached dependencies
11:05:21 AM: Failed to fetch cache, continuing with build
11:05:21 AM: Starting to prepare the repo for build
11:05:21 AM: No cached dependencies found. Cloning fresh repo
11:05:21 AM: git clone https://github.com/username/blog
11:07:30 AM: Error cloning repository: https://github.com/username/blog
11:07:30 AM: Creating deploy upload records
11:07:30 AM: Failing build: Failed to prepare repo
11:07:41 AM: Failed during stage 'preparing repo': exit status 128
11:07:41 AM: Finished processing build request in 2m35.220824723s

どうやらキャッシュの fetch に失敗したようです。

エラー2の解決方法

これはデプロイのキャッシュをリセットしてあげれば良いです。

よって、管理画面で

  1. 失敗した Deploy ページを開く
  2. Retry
  3. Clear cache and retry with latest branch commit

をしたら良いです。

netlify2

まとめ

以上です。日本語の記事もなかったので書いてみました。

誰かの参考になれば幸いです。

それでは!!!

質問、誤記などあれば Twitter などでご指摘よろしくおねがいします!

また、以下の記事にもう少し簡潔にした内容があります。

Gatsby で目次を自動生成する htmlAst を使った方法

人気記事

PHP7.4 + Laravel6 のプロジェクトを AWS EC2 にデプロイする

関連記事

【ReactNative+CloudVision】「怒り顔採点アプリ」を作った