Deploy Hugo website always fails when caching is used

Hello,

I’m running the Hugo build command using hugo-installler. This npm package installs Hugo in the bin/hugo folder using a postinstall script. Local production builds + GitHub CI builds always run successfully.

When using Netlify, building my Netlify site only succeeds when clicking Trigger deploy > Clear cache and deploy site. See e.g. Netlify App

In all other cases /when the cache is used, building my Netlify site fails. See e.g. Netlify App

How can I make it always work OK?

Is there a (bin) directory cached, so hugo-installer could install there?

Hi @h-enk,

May I know why you need hugo-installer? If there a specific reason? I’m asking because Netlify automatically installs Hugo for you and this step should not be required.

node_modules/.bin does the trick

Hi @hrishikesh, to keep my production workflow in line w/ my development workflow. Why I use hugo-installer locally?

If we could install Hugo locally as a dependency, we would have full control over the Hugo version used in our project. And best of all, all our project users would use the same version.

Managing Dependencies — Integrating with Hugo

Sure, but for future reference, you could also set a specific Hugo Version on Netlify:

I know, but that won’t work for me locally /in development — I’d like to have dev/prod parity