PostCSS does not work in directories with spaces

Used this guide to install and test postCSS but I get this error

$ hugo serve
Start building sites …
hugo v0.100.0-27b077544d8efeb85867cb4cfb941747d104f765+extended windows/amd64 BuildDate=xxxx VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/root.css" (text/css): 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Built in 1448 ms

If it matters, I store and run Hugo in C:\Users\user\Documents. The postcss.config.js file looks like this

module.exports = {
     plugins: [
      require("autoprefixer")({
            browsers: [
                "> 1%",
                "last 2 versions"
            ]
        })
     ]
}

What is the complete path to your project directory?

C:\Users\user-name\Documents\projects\hugo-project-1 (projects houses my all sites, test sites and the Hugo binary.) node_modules, package-lock.json, package.json, and postcss.config.js are in the root of the hugo-project-1. I have Node.js installed too.

(I only want to add vendor prefixes to my CSS using postCSS )

This is not the complete path to your project directory.

What is the value of user-name? Does it contain a space?
What is the value of hugo-project-1? Does it contain a space?

This was the problem. Solved by removing the spaces.

https://github.com/gohugoio/hugo/issues/7333

So it is a known issue…I had to create a new user account and copy paste the files from the old user to the new user (since renaming the user in the registry corrupted the account). I hope some progress will come out of this.

See this comment for a workaround:
https://github.com/gohugoio/hugo/issues/7333#issuecomment-1048571703

Thanks. I will mark that in case this happens again.

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