PostCSS hash issue on Netlify

I am trying to move my website from Bulma to Tailwind. Tailwind requires PostCSS. I set the site up and everything works locally, both with hugo and hugo server.

{{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint | resources.PostProcess }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">

But once I push to Netlify I get the following error:

10:17:13 PM: Installing Hugo 0.69.0
10:17:14 PM: Hugo Static Site Generator v0.69.0-4205844B/extended linux/amd64 BuildDate: 2020-04-10T09:16:58Z
10:17:14 PM: Started restoring cached go cache
10:17:14 PM: Finished restoring cached go cache
10:17:14 PM: unset GOOS;
10:17:14 PM: unset GOARCH;
10:17:14 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
10:17:14 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
10:17:14 PM: go version >&2;
10:17:14 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
10:17:14 PM: go version go1.12 linux/amd64
10:17:14 PM: Installing missing commands
10:17:14 PM: Verify run directory
10:17:14 PM: Executing user command: hugo -v --gc --minify
10:17:14 PM: INFO 2020/04/12 15:17:14 No translation bundle found for default language "en"
10:17:14 PM: INFO 2020/04/12 15:17:14 Translation func for language en not found, use default.
10:17:14 PM: INFO 2020/04/12 15:17:14 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
10:17:15 PM: INFO 2020/04/12 15:17:15 Using config file:
10:17:15 PM: Building sites …
10:17:15 PM: INFO 2020/04/12 15:17:15 syncing static files to /opt/build/repo/public/
10:17:17 PM: Total in 2580 ms
10:17:17 PM: Error: Error building site: POSTCSS: failed to transform "css/styles.css" (text/css): resource "css/css/styles.css_f2054ba793222939610cd2936fa9ba1e" not found in file cache

Netlify uses the latest Hugo release (0.69.0).

On my local machine the file that was created instead of the missing one is called styles.min.799082e60499a91e39e7baf8c2d30596fbecafbdbad0ad2ffeb4e578ff48035b. It is not checked into Git so Netlify should not have an old version. (I tried Netlify’s Clear cache and deploy site with no effect.)

The only hint I could find online was this issue about a new hash function: Build Script: Themes broken in 0.66.0.

I have no idea how it should affect me as I started using PostCSS with Hugo 0.68.1 before moving to 0.69.0.

I created a local Netlify environment which failed with issues that seem to be unrelated.

Does anyone know what’s going on or what I could try to debug? @bep, @alexandros, you’ve both been involved in the quoted issue. Any ideas?

Thanks in advance and Happy Easter!

When running hugo locally and it works, are you also using the --minify option?


hugo --gc --minify

                   | EN   
  Pages            | 925  
  Paginator pages  | 131  
  Non-page files   |   1  
  Static files     |  60  
  Processed images |   0  
  Aliases          | 137  
  Sitemaps         |   1  
  Cleaned          |   6  

Total in 3664 ms

I removed all SASS processing (which caused the errors on my local Netlify environment) and could then build the site on local Netlify as well.

buildbot@09680df7bc12:/$ build hugo --gc --minify
Installing dependencies
v10.20.1 is already installed.
Now using node v10.20.1 (npm v6.14.4)
Attempting ruby version 2.6.2, read from environment
Using ruby version 2.6.2
Using PHP version 5.6
Started restoring cached node modules
Finished restoring cached node modules
Installing Hugo 0.69.0
Hugo Static Site Generator v0.69.0-4205844B linux/amd64 BuildDate: 2020-04-10T09:12:34Z
Started restoring cached go cache
Finished restoring cached go cache
Installing Go version 1.12

unset GOOS;
unset GOARCH;
export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
go version >&2;

export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
go version go1.12 linux/amd64
/usr/local/bin/ line 597: /opt/buildhome/.wasmer/ No such file or directory
Installing missing commands
Verify run directory
Executing user command: hugo --gc --minify

                   | EN   
  Pages            | 925  
  Paginator pages  | 131  
  Non-page files   |   1  
  Static files     |  50  
  Processed images |   0  
  Aliases          | 137  
  Sitemaps         |   1  
  Cleaned          |   0  

Total in 998 ms

So the problem had to be on Netlify production. The only difference seemed to be that my local environment didn’t use the netlify.toml file. I played around and found that I had added

NODE_ENV = "production"

to the production settings when adding a package.json.

Deleting the line solved the problems.

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