PostCSS problem with Cloudflare Pages

I’m receiving the same error trying to deploy this tailwind starter theme on Cloudflare Pages.

Error: error building site: POSTCSS: failed to transform "css/styles.css" (text/css). Check your PostCSS installation; install with "npm install postcss-cli". See binary with name "npx" not found

The theme works just fine locally.

The original Github issue [#9730] reported the following

It looks like any errors with the npx call get handled as if postcss is not supported.

I’m out of my depth here and wondering where I might begin troubleshooting? I’ve set environment variables to make sure the correct version of Hugo is being used. I’ve got other Hugo sites deploying fine on CFP, but they are not using postcss.

Does your CI/CD deployment run npm ci to install the Node.js dependencies?

1 Like

@jmooring I changed the build command to include npm ci' and it worked. I was under the impression that Cloudflare Pages installed dependencies if a package.json` file was present. A beginner mistake! Thank you for the help.

I have another Hugo+Tailwind site working on Clouflare Pages with hugo as the only build command, but it’s not using Postcss. Learning the hard way!

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