【Hugo】Error: <.Page.Store.Get> Netlify への Deploy 失敗時の対処

【Hugo】Error: <.Page.Store.Get> Netlify への Deploy 失敗時の対処

Hugo 2024/7/17

結論

Netlify 側の HUGO の バージョンが古かった(指定していなかった)のが原因。
netlify.toml でローカルの環境と同じ HUGO のバージョンにすることで問題なく Deploy ができた。

Netlify 側の Deploy log (失敗時)

1:37:09 AM: hugo v0.85.0-724D5DB5+extended linux/amd64 BuildDate=2021-07-05T10:46:28Z VendorInfo=gohugoio
1:37:09 AM: ERROR 2024/07/16 16:37:09 render of "page" failed: execute of template failed: template: posts/single.html:23:11: executing "posts/single.html" at <partial "javascript.html" .>: error calling partial: "/opt/build/repo/themes/hello-friend-ng/layouts/partials/javascript.html:13:11": execute of template failed: template: partials/javascript.html:13:11: executing "partials/javascript.html" at <.Page.Store.Get>: can't evaluate field Store in type page.Page
ERROR 2024/07/16 16:37:09 render of "page" failed: execute of template failed: template: posts/single.html:23:11: executing "posts/single.html" at <partial "javascript.html" .>: error calling partial: "/opt/build/repo/themes/hello-friend-ng/layouts/partials/javascript.html:13:11": execute of template failed: template: partials/javascript.html:13:11: executing "partials/javascript.html" at <.Page.Store.Get>: can't evaluate field Store in type page.Page
ERROR 2024/07/16 16:37:09 render of "page" failed: execute of template failed: template: posts/single.html:23:11: executing "posts/single.html" at <partial "javascript.html" .>: error calling partial: "/opt/build/repo/themes/hello-friend-ng/layouts/partials/javascript.html:13:11": execute of template failed: template: partials/javascript.html:13:11: executing "partials/javascript.html" at <.Page.Store.Get>: can't evaluate field Store in type page.Page
ERROR 2024/07/16 16:37:09 render of "page" failed: execute of template failed: template: posts/single.html:23:11: executing "posts/single.html" at <partial "javascript.html" .>: error calling partial: "/opt/build/repo/themes/hello-friend-ng/layouts/partials/javascript.html:13:11": execute of template failed: template: partials/javascript.html:13:11: executing "partials/javascript.html" at <.Page.Store.Get>: can't evaluate field Store in type page.Page
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: posts/single.html:23:11: executing "posts/single.html" at <partial "javascript.html" .>: error calling partial: "/opt/build/repo/themes/hello-friend-ng/layouts/partials/javascript.html:13:11": execute of template failed: template: partials/javascript.html:13:11: executing "partials/javascript.html" at <.Page.Store.Get>: can't evaluate field Store in type page.Page
Total in 292 ms

netlify.toml の設定値

[build]
  command = "hugo"
  publish = "public"

[build.environment]
  HUGO_VERSION = "YOUR_HUGO_VERSION"

参照: https://docs.netlify.com/frameworks/hugo/