Error building site: POSTCSS

I’m publishing a site to GitHub pages. When I build the site with baseURL: \ in config.yaml, it serves locally. When I add the github.io repository url, I get this error:

Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): resource "css/hugo-eureka/css/eureka.css_fc3f76d7bee2760c3a903059afc3d9b2" not found in file cache

I tried postcss-cli according to suggestion here but no luck.

Here’s the repository: https://github.com/whanley/hugo-eureka

Thanks for any help…

I was able to locally reproduce and solve the problem. This was my approach to troubleshooting…

git clone https://github.com/whanley/hugo-eureka
cd hugo-eureka
hugo

The site built without errors. So let’s delete the theme resources to reproduce the problem.

rm -rf themes/eureka/resources/
hugo

Result:

Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): resource "css/css/eureka.css_fc3f76d7bee2760c3a903059afc3d9b2" not found in file cache

So, I need to install the various npm modules.

cp themes/eureka/package.json .
npm install
hugo

Result:

Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): resource "css/css/eureka.css_fc3f76d7bee2760c3a903059afc3d9b2" not found in file cache

This should have generated the necessary files in resources/_gen/assets.

ls resources/_gen/assets/

The directory is empty. Hmm.

Then I saw the last two lines in your config.yaml file:

build:
  useResourceCacheWhen: always

I had to look that one up:
https://gohugo.io/getting-started/configuration/#configure-build

Let’s change that:

build:
  useResourceCacheWhen: fallback

And then build the site again:

hugo

Result:

Start building sites … 

                   | EN  
-------------------+-----
  Pages            | 57  
  Paginator pages  |  1  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  3  
  Aliases          | 14  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 2794 ms
3 Likes

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