Failed to transform - path not found

I am having an issue running hugo server -D as it cannot find the POSTCSS transform executable. I believe it is likely missing quotes around the executable path, but I am unsure where to look for the location that specifies C:\Program ... etc. Where should I look to troubleshoot this error?

Error: Error building site: POSTCSS: failed to transform “fullstyle.css” (text/css): ‘C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

It’s not about POSTCSS, but about a path you are using. You are on Windows and have a folder “Program Files” somewhere. The space on the bash needs to be either backslashed (Program\ Files) or the whole path to whatever is looked for in Program Files needs to be in quotation marks. Depends on what exactly is throwing the error, so post a sample or your repo and we can have a look. Or maybe just search the whole project for “Program Files” and decide which one is the culprit :slight_smile: Then add "C:/Program Files/bla/fase" with quotation marks instead.

Typically you would place your project somewhere in your profile, something like:

C:\Users\Foo\my-hugo-site\

But make sure the path to your project does not contain spaces:
https://github.com/gohugoio/hugo/issues/7333

I wonder if maybe a local postcss installation would solve the issue on Windows and this is happening because postcss is installed globally and as such somehow in the program files folder. I never developed on Windows though…

No, see the issue comments, and the last one for a workaround that does not involve changing the project path.

1 Like

That’s worth a note in the docs.

Or getting the upstream Go issues addressed. It’s a stupid bug.

1 Like

Yep. It is. But that will be fixed very slow.

I placed my project in C: drive and path didn’t contain any spaces. By doing so, project ran successfully. Thanks.

But how come placing the project in another drive gave me that issue?

'C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

Thats what is described in the linked issue.

On many operating systems a pathname with a space (or any other non-alphanumerical character) needs escaping. Which is done by quotation marks or backslashes or by not using spaces in path names. Windows then came to the table and decided to it all better and different.

In this specific case, the Golang tool (package or module?) that takes care of paths and hands paths over to its scripts did not escape the space.

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