Hello,
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)
for https://github.com/influxdata/docs-v2
Any ideas? I appreciate the help ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=9)
H
Please run hugo version
and post the results. Also, how did you install Hugo?
@jmooring
from the tarball as per https://gohugo.io/getting-started/installing/#install-hugo-from-tarball
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.
Thanks
I am unable to reproduce the problem with:
- Ubuntu 20.04.1 LTS
- Hugo v0.79
- nodejs v14.15.2
git clone https://github.com/influxdata/docs-v2
cd docs-v2/
npm init -y
npm install -D postcss postcss-cli autoprefixer
hugo
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.