Github build fails - suddenly having difficulty with css transforms

Everything was working along swimmingly for my site and then all of a sudden I started getting github action fails. It works fine locally.

Run hugo --minify
Start building sites …
hugo v0.99.0-1de333e7a3fc863672ec6d6cd53ba66dbcdd2305+extended linux/amd64 BuildDate=2022-05-16T08:10:56Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): resource "css/css/eureka.css_2708f438472623f2f528f6c292f4e324" not found in file cache
Total in 895 ms
Error: Process completed with exit code 255.

Repository is here: GitHub - tknx/ttk

I am publishing from this repository which is normally private to another repository which is public.

I just tried chaging useResourceCacheWhen to fallback per @jmooring 's post here and it changes the error, but still broken.

Run hugo --minify
Start building sites … 
hugo v0.99.0-1de333e7a3fc863672ec6d6cd53ba66dbcdd2305+extended linux/amd64 BuildDate=2022-05-16T08:10:56Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): Error: Cannot find module 'postcss-import'
Total in 2013 ms
Require stack:
- /home/runner/work/ttk/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js
- /home/runner/work/ttk/ttk/node_modules/lilconfig/dist/index.js
- /home/runner/work/ttk/ttk/node_modules/postcss-load-config/src/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/runner/work/ttk/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js:6:9)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/ttk/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js',
    '/home/runner/work/ttk/ttk/node_modules/lilconfig/dist/index.js',
    '/home/runner/work/ttk/ttk/node_modules/postcss-load-config/src/index.js'
  ]
}
npm notice 
npm notice New minor version of npm available! 8.5.5 -> 8.10.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.10.0>
npm notice Run `npm install -g npm@8.10.0` to update!
npm notice
Error: Process completed with exit code 255.

https://discourse.gohugo.io/t/correct-css-not-being-generated-when-deploying-to-github-pages/37593/4

Sadly that did not fix it, same error as the first post.

You have:

useResourceCacheWhen: always

No.

So do I use fallback? I tried that and it fails locally as follows:

% hugo server -D
Start building sites … 
hugo v0.89.4+extended darwin/amd64 BuildDate=unknown
Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): Error: Cannot find module 'postcss-import'
Require stack:
- /Users/tarun/Desktop/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js
- /Users/tarun/Desktop/ttk/node_modules/lilconfig/dist/index.js
- /Users/tarun/Desktop/ttk/node_modules/postcss-load-config/src/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at Module._load (node:internal/modules/cjs/loader:780:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/tarun/Desktop/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js:6:9)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/tarun/Desktop/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js',
    '/Users/tarun/Desktop/ttk/node_modules/lilconfig/dist/index.js',
    '/Users/tarun/Desktop/ttk/node_modules/postcss-load-config/src/index.js'
  ]
}
Built in 1147 ms

and fails on deploy as well:

Run hugo --minify
Start building sites … 
hugo v0.99.0-1de333e7a3fc863672ec6d6cd53ba66dbcdd2305+extended linux/amd64 BuildDate=2022-05-16T08:10:56Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/eureka.css" (text/css): Error: Cannot find module 'postcss-import'
Total in 1237 ms
Require stack:
- /home/runner/work/ttk/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js
- /home/runner/work/ttk/ttk/node_modules/lilconfig/dist/index.js
- /home/runner/work/ttk/ttk/node_modules/postcss-load-config/src/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/runner/work/ttk/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js:6:9)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/ttk/ttk/_vendor/wangchucheng.com/hugo-eureka/assets/css/postcss.config.js',
    '/home/runner/work/ttk/ttk/node_modules/lilconfig/dist/index.js',
    '/home/runner/work/ttk/ttk/node_modules/postcss-load-config/src/index.js'
  ]
}
Error: Process completed with exit code 255.

What’s weird is that with Always, it works locally, just not on deploy.

Solved it - had to npm install postcss-import and tailwindcss manually using npm in the site directory and it worked. Not sure why it worked before and not now.

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