Pages - Hugo Build Continues to Fail

Hi Everyone,

I’m new to Pages (have more of a Netlify background), and having some issues with getting a Hugo build running successfully.

16:38:53.954	[20:38:53] Finished 'images' after 1.75 s
16:38:54.481	[20:38:54] Finished 'styles:production' after 2.34 s
16:38:54.481	[20:38:54] Starting 'styles:development'...
16:38:54.481	[20:38:54] Finished 'styles:development' after 90 μs
16:38:54.481	[20:38:54] Finished 'styles' after 2.34 s
16:38:54.481	[20:38:54] Starting 'generator'...
16:38:54.481	HUGO_ENV
16:38:54.502	[20:38:54] [Hugo] Total in 0 ms
16:38:54.502	[20:38:54]        
16:38:54.502	[20:38:54] [Hugo] Error: failed to create cache dir: mkdir /opt/build/cache: permission denied
16:38:54.502	[20:38:54]        
16:38:54.503	[20:38:54] Finished 'generator' after 22 ms
16:38:54.503	[20:38:54] Finished 'build' after 2.37 s
16:38:55.023	Finished
16:38:55.023	Validating asset output directory
16:38:55.469	Deploying your site to Cloudflare's global network...
16:38:56.596	Failed: build output directory not found

Continue to see this error -
[Hugo] Error: failed to create cache dir: mkdir /opt/build/cache: permission denied

and this
Failed: build output directory not found

Everything works locally, and we are using a similar boilerplate that we run on Netlify with no issues.

Anybody come across this yet? If so, any ideas?

1 Like

UPDATE: If you come cross this issue.

See this thread on Github - The "Netlify default cache dir logic" does not work · Issue #8710 · gohugoio/hugo · GitHub

Setting the cache directory variable to /tmp fixed the issue I was having.

1 Like

+1 me too