PostCSS error with snap install

If I use the Snap extended release (stable) I get the following error:

Error: Error building site: POSTCSS: failed to transform “scss/main.css” (text/css). Check your PostCSS installation; install with “npm install postcss-cli”. See https://gohugo.io/hugo-pipes/postcss/: this feature is not available in your current Hugo version, see Frequently Asked Questions | Hugo for more information

Version information:

hugo v0.91.0+extended linux/amd64 BuildDate=2021-12-17T14:49:05Z

If I download from GitHub assets, I get a version that works:

hugo v0.91.0-D1DC0E9A+extended linux/amd64 BuildDate=2021-12-17T09:50:20Z VendorInfo=gohugoio

Is something missing from the Snap package, or am I missing something?

The first thing about this error (postcss on snap not working) is this: You either need to have all packages for your postcss (postcss, postcss-cli and all plugins you use) installed globally OR in your project locally. Not mixed. The error message is a bit misleading probably.

If you can, don’t use the snap-hugo-version. If you are on Ubuntu or something like that, download the extended version ending on .deb and install via sudo dpkg -i filename.deb. Snap-Hugo is known to be a bit fussy, mostly due to the security features of snap that prevent access between programs.

1 Like

Thanks for the tips.

I mentioned it on the 0.91.0 release as I didn’t have this issue with 0.90.1 or any other hugo version since hugo v0.88.1+extended linux/arm64 which were also installed through snap. Hence my assumption that it was the release process that had broken it, not Hugo itself.

0.91.0 works fine from the repo asset, so I will change my code to download it from there in the future. Also makes it easier to test and to go back to previous versions if necessary.

1 Like