POSTCSS: failed to transform
filcuk opened this issue · 2 comments
filcuk commented
I'm trying to spin up Hugo with the extended image but it errors out on PostCSS:
Start building sites …
hugo v0.104.3-58b824581360148f2d91f5cc83f69bd22c1aa331+extended linux/amd64 BuildDate=2022-10-04T14:25:23Z VendorInfo=hugoguru
Total in 6440 ms
Error: Error building site: POSTCSS: failed to transform "css/styles.css" (text/css): Error: Cannot find module '@fullhuman/postcss-purgecss'
Require stack:
- /src/themes/showfolio/assets/css/postcss.config.js
- /usr/local/node/lib/node_modules/postcss-cli/node_modules/lilconfig/dist/index.js
- /usr/local/node/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/index.js
- /usr/local/node/lib/node_modules/postcss-cli/index.js
- /usr/local/node/lib/node_modules/postcss-cli/bin/postcss
at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)
at Module._load (node:internal/modules/cjs/loader:787:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/src/themes/showfolio/assets/css/postcss.config.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1112:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at Module.require (node:internal/modules/cjs/loader:1012:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/src/themes/showfolio/assets/css/postcss.config.js',
'/usr/local/node/lib/node_modules/postcss-cli/node_modules/lilconfig/dist/index.js',
'/usr/local/node/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/index.js',
'/usr/local/node/lib/node_modules/postcss-cli/index.js',
'/usr/local/node/lib/node_modules/postcss-cli/bin/postcss'
]
}
npm notice
npm notice New minor version of npm available! 8.12.1 -> 8.19.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.2>
npm notice Run `npm install -g npm@8.19.2` to update!
npm notice
It seems like it's missing the module, could that be anything on my side?
andrewheberle commented
I'm getting a similar problem but in my case it's failing with "tailwindcss":
Start building sites …
hugo v0.107.0-2221b5b30a285d01220a26a82305906ad3291880+extended linux/amd64 BuildDate=2022-11-24T13:59:45Z VendorInfo=hugoguru
Error: Error building site: POSTCSS: failed to transform "css/directory/main.css" (text/css): Error: Cannot find module 'tailwindcss'
I can build my project fine using my local version of hugo (version 0.105.0) on my dev workstation, and it builds fine via Cloudflare Pages, but we are looking at changing our CI process and this is where it fails for some reason.
If I build my own image composed of the following the build succeeds the same as on my dev workstation:
- node:lts (base)
- Hugo 0.107.0-extended
- Go1.19.3
filcuk commented
My issue went away when I used a different theme.
The theme causing an error was 'showfolio', I haven't had the same issue with other ones.