raddo.co

personal technical blog of raddo

2-Minute Read

Mountain Scape

Using Hugo and hosting on Cloudflare pages the build fails with somehting simialr in the build log:

17:44:41.126	Building sites … ERROR 2021/10/18 06:44:41 error: failed to transform resource: template: js/main.js:63:45: executing "js/main.js" at <.Site.BaseURL>: can't evaluate field Site in type *hugolib.SiteInfo
17:44:41.415	ERROR 2021/10/18 06:44:41 render of "page" failed: execute of template failed: template: _default/single.html:13:9: executing "_default/single.html" at <partial "scripts" .>: error calling partial: "/opt/buildhome/repo/themes/hugo-future-imperfect-slim/layouts/partials/scripts.html:43:37": execute of template failed: template: partials/scripts.html:43:37: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "/" and "application/javascript"
17:44:41.415	ERROR 2021/10/18 06:44:41 render of "page" failed: execute of template failed: template: _default/single.html:13:9: executing "_default/single.html" at <partial "scripts" .>: error calling partial: "/opt/buildhome/repo/themes/hugo-future-imperfect-slim/layouts/partials/scripts.html:43:37": execute of template failed: template: partials/scripts.html:43:37: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "/" and "application/javascript"
17:44:41.415	ERROR 2021/10/18 06:44:41 render of "page" failed: execute of template failed: template: _default/about.html:13:9: executing "_default/about.html" at <partial "scripts" .>: error calling partial: "/opt/buildhome/repo/themes/hugo-future-imperfect-slim/layouts/partials/scripts.html:43:37": execute of template failed: template: partials/scripts.html:43:37: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "/" and "application/javascript"
17:44:41.415	ERROR 2021/10/18 06:44:41 render of "page" failed: execute of template failed: template: _default/single.html:13:9: executing "_default/single.html" at <partial "scripts" .>: error calling partial: "/opt/buildhome/repo/themes/hugo-future-imperfect-slim/layouts/partials/scripts.html:43:37": execute of template failed: template: partials/scripts.html:43:37: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "/" and "application/javascript"
17:44:41.415	Total in 368 ms
17:44:41.415	Error: Error building site: failed to render pages: render of "taxonomyTerm" failed: "/opt/buildhome/repo/themes/hugo-future-imperfect-slim/layouts/_default/terms.html:10:29": execute of template failed: template: _default/terms.html:10:29: executing "main" at <.Page.Permalink>: can't evaluate field Page in type hugolib.OrderedTaxonomyEntry
17:44:41.421	Failed: build command exited with code: 255

Try setting the HUGO_VERSION to the version on your local machine or the most recent version, in my case at the time I had to set it to 0.88.1.

This is a known issue in Cloudflare pages where the build environment by default uses an old version: Cloudflare Pages known issues

Recent Posts

Category