Cloudflare PagesでHugo+SCSS環境のビルドに失敗する

環境・状況

  • Cloudflare Pages

記事を更新しようとしたらビルドに失敗した.今までビルドに成功していたし,設定周りはいじっていないのになぜ…という感じ

エラー内容

~~ 省略 ~~
21:56:35.651	Executing user command: hugo
21:56:35.922	Start building sites … 
21:56:35.922	hugo v0.121.1-00b46fed8e47f7bb0a85d7cfc2d9f1356379b740+extended linux/amd64 BuildDate=2023-12-08T08:47:45Z VendorInfo=gohugoio
21:56:35.922	
21:56:36.450	Total in 529 ms
21:56:36.450	Error: error building site: TOCSS-DART: failed to transform "sass/main.scss" (text/x-scss): got unexpected EOF when executing "sass". The user running hugo must have read and execute permissions on this program. With execute permissions only, this error is thrown.
21:56:36.456	Failed: Error while executing user command. Exited with error code: 1
21:56:36.465	Failed: build command exited with code: 1
21:56:37.431	Failed: error occurred while running build command

SASSの実行ができないというエラーが出た.

試したこと

①ビルドの再実行(ビルド失敗)

同じエラーが出て変わらず

②Hugoのバージョン指定をあげる(ビルド失敗)

Cloudflare Pagesの設定で,HUGO_VERSIONを最新の0.142.0に指定した.再ビルドは失敗

③Editorconfigの導入(ビルド失敗)

21:56:36.450 Error: error building site: TOCSS-DART: failed to transform "sass/main.scss" (text/x-scss): got unexpected EOF when executing "sass".というエラーメッセージを見て,他プロジェクトで使ってるeditorconfigの改行コード設定をしていないことを思い出したので.editorconfigを追加して再ビルド.このエラーログの後を見たら分かるとおり実行権限の問題がエラーの原因らしく,まあビルドに失敗する

④パッケージのアップデート(ビルド失敗)

影響しそうなパッケージ無いけどなぁと思いつつbun updateしてみる.特に変わらず.

⑤ランタイムの設定を変える(ビルド失敗)

Pages Function使ってないけど念の為,互換性の日付を最新の5月 5, 2025に変えてみた.もちろん結果は変わらず.

⑥ビルドシステムのバージョンを上げる(ビルド成功🙌)

Cloudflare Pagesの設定から,ビルド システムのバージョンを「バージョン3」に上げたら直った.Goのバージョンが上がったのが原因か?


comments powered by Disqus