I did something dumb and broke my Hermit Themed Hugo Site.
In brief, I upgraded Hugo to 0.58.0 and Hermit to the latest by removing and re-adding the submodule.
When I run hugo --gc --minify, I get the following error:
5:44:05 PM: Error: failed to prune cache "assets": remove /opt/build/repo/resources/_gen/assets/js/js/bundle.js_d11fe7b62c27961c87ecd0f2490357b9.content: no such file or directory
Where can I begin toward trying to figure this one out?
What I’ve discovered is that if I manually copy the files below into the resources/_gen/js/js directory, I can run hugo --gc --minify exactly once, and then they disappear.
--gc cleans out the resources folder. If it looks for a folder that does not exist then the error comes up. In my opinion you stumbled on a bug (cc @bep) where --gc builds the list of files to delete in the resources folder wrong. The double js has to come from somewhere and I am sure that if you run hugo with --gc, then take the paths from the errors and remove one js you will find the files in your file system. that’s the bug.
This may be a bug, but the “–gc” routine does no file locking (which is by design), so if “someone or something” deletes these files while it’s running you may have a race …
That said, if it’s a bug it’s most likely a OS dependent path issue, but I would expect other people to also shout.
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’sresources 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.