Hugo Modules on ZEIT Now

Hey all,

We’re giving ZEIT Now a try to deploy Hugo. Our site uses some Hugo modules (theme components) and it causes deploy to fail.

You can perfectly install Go and Hugo on ZEIT to tailor your environment, so that’s what we did but we’re still facing a cache error on resource:

23:52:25.979  Installing Hugo 0.69.0...
23:52:27.869  Hugo Static Site Generator v0.69.0-4205844B/extended linux/amd64 BuildDate: 2020-04-10T09:16:58Z
23:52:27.977  Running Hugo...
23:52:28.602  hugo: collected modules in 602 ms
23:52:29.540  Building sites … Total in 1541 ms
23:52:29.541  Error: Error building site: POSTCSS: failed to transform "assets/css/main.css" (text/css): resource "scss/scss/main.scss_97926dd476e00bee4d471a0eb9d338c8" not found in file cache

Any feedback welcome on how to use Hugo Modules on ZEIT welcome, it could be a nice addition to Hugo documentation.

You need the extended version of Hugo.

23:52:27.869 Hugo Static Site Generator v0.69.0-4205844B/extended linux/amd64 BuildDate: 2020-04-10T09:16:58Z

It’s with the extended version.

“scss/scss/main.scss_97926dd476e00bee4d471a0eb9d338c8”

scss/scss/ looks like an error …

can you share a (sample) repository?

repo is public on https://github.com/jamstatic/jamstatic-fr
(it deploys fine on Netlify and Forestry.io as is)

I thought it was related to https://github.com/jamstatic/jamstatic-fr/blob/master/config/production/config.yml#L7-L9

but even with cache disabled, I still get the same error.

don’t use assets directory for output!

assets

Stores all the files which need be processed by Hugo Pipes. Only the files whose .Permalink or .RelPermalink are used will be published to the public directory. Note: assets directory is not created by default.

my 2c

I don’t think this is a problem with Hugo Modules, but rather a NPM setup … or something.

*With PostCSS Hugo will first try to build it with … PostCSS.

  • If not, it will look in the file cache (default resources/_gen/…)
  • I’m not sure if you commit your resources folder or not
  • We did make some change to the option object in PostCSS that made the hashes change,ywhich would require a rebuild of those assets (unfortunately)

I’m not sure what applies to your situation.

So if you have PostCSS defined correctly in package.json then Netlify by default does a “npm install” before int builds, not sure what Zeit is doing. If not, the workaround is to commit the resources/_gen folder.

4 Likes

Thanks @bep for the hint, you were right, we were just missing installing node packages: :relaxed:

For those curious: https://github.com/jamstatic/jamstatic-fr/pull/195/files
(we could use git to install the submodule instead)

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.