TOCSS: failed to transform dark theme


I get the following error when trying to run Hugo

2020/12/16 16:29:23 POSTCSS: failed to transform "dark-theme.css" (text/css): /usr/local/lib/node_modules/postcss-cli/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
     } catch {

SyntaxError: Unexpected token {
   at createScript (vm.js:80:10)
   at Object.runInThisContext (vm.js:152:10)
   at Module._compile (module.js:605:28)
   at Object.Module._extensions..js (module.js:652:10)
   at Module.load (module.js:560:32)
   at tryModuleLoad (module.js:503:12)
   at Function.Module._load (module.js:495:3)
   at Module.require (module.js:585:17)
   at require (internal/module.js:11:18)
   at Object.<anonymous> (/usr/local/lib/node_modules/postcss-cli/node_modules/fs-extra/lib/mkdirs/index.js:3:44)


Any ideas? I appreciate the help :slight_smile:


Please run hugo version and post the results. Also, how did you install Hugo?

from the tarball as per
Hugo Static Site Generator v0.75.0-FEF924BA/extended darwin/amd64 BuildDate: 2020-09-14T09:26:37Z
Because the site I’m trying to build hasn’t been tested past that version.

I am unable to reproduce the problem with:

  • Ubuntu 20.04.1 LTS
  • Hugo v0.79
  • nodejs v14.15.2
git clone
cd docs-v2/
npm init -y
npm install -D postcss postcss-cli autoprefixer

We ran into a similar problem here, which was apparently resolved by installing a current version of nodejs.

I remember the } catch { error coming up on my projects because the used postcss version was running on an old node/npm system. Your error message uses a globally installed postcss-cli. I would try to run

npm install -D postcss postcss-cli

That will add the packages locally to the repo and it might get Hugo to use the local packages instead of the global ones.

Or updating to the latest LTS node version ( *Latest LTS* Version: 14.15.2 (includes *npm* 6.14.9)) will help.

Edit: Now you might end up with errors like “plugin not found”. You need to install ALL postcss packages next to the version you are using, so if you use it locally in your repo you need to add the plugins too with npm install -D.

Thanks. I will try these solutions and report back.

Thanks! Upgrading to node 14.15.2 worked.