Hugo Build Error with --gc --minify

Hi! I have a similar problem:

I also use the Hermit theme, but just as a start to my own theme. After updating from Hugo 0.56 to 0.57.2, if I use --gc, I’ve got this error:

Error: failed to prune cache "assets": remove /opt/build/repo/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.content: no such file or directory

This happens even if I change the name of main.js to any other name (Hermit has an assets/js/main.js file). And the problem occurs both at my machine (Manjaro Linux) and at Netlify.

If I update Hermit theme, the error changes to exactly the same as of @kimfucious (with bundle.js instead of main.js in error message). If I remove theme’s resources folder, then --gc works as expected. But Netlify uses theme directly from its repository (because it’s a submodule), thus resources folder is always there.

This relates to gohugoio/hugo#5745

1 Like