hugo version)?$ hugo version Hugo Static Site Generator v0.70.0/extended linux/amd64 BuildDate: 2020-05-13T17:30:34Z
Yes.
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal
git clone --single-branch -b hugo-github-issue-7278 https://github.com/jmooring/hugo-testing hugo-github-issue-7278
cd hugo-github-issue-7278
npm ci
/snap/bin/hugo
`npm ci` is required to locally install poscss-cli and autoprefixer.
### Details
Building sites … /home/jmooring/temp/hugo-gh-issue-7278/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/jmooring/temp/hugo-gh-issue-7278/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
ERROR 2020/05/15 08:46:32 POSTCSS: failed to transform "sass/main.css" (text/css): /home/jmooring/temp/hugo-gh-issue-7278/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/jmooring/temp/hugo-gh-issue-7278/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
Total in 185 ms
Error: Error building site: failed to render pages: render of "page" failed: "/home/jmooring/temp/hugo-gh-issue-7278/layouts/_default/baseof.html:9:14": execute of template failed: template: _default/single.html:9:14: executing "_default/single.html" at <$style.Content>: error calling Content: POSTCSS: failed to transform "sass/main.css" (text/css): /home/jmooring/temp/hugo-gh-issue-7278/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/jmooring/temp/hugo-gh-issue-7278/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
Discussion from the Hugo support queue:
https://discourse.gohugo.io/t/postcss-error-building-site-since-yesterday/25513
It seems to have something to do with parameterless catch statements in the newest version of node-fs-extra.
This is a new feature only available in nodejs since 10.3.
https://github.com/jprichardson/node-fs-extra/blob/master/lib/mkdirs/make-dir.js#L85
My Node version is 12.16.2 and still happens. Any workarounds?
Also reproducible with snap installation of Hugo Static Site Generator v0.71.1/extended linux/amd64 BuildDate: 2020-05-25T13:06:06Z.
Also reproducible with snap installation of Hugo Static Site Generator v0.72.0/extended linux/amd64 BuildDate: 2020-05-31T18:10:04Z
For the workarounds, using hugo binary from github release.
sudo snap remove hugo
mkdir hugobin
cd hugobin
curl -L https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_extended_0.74.3_Linux-64bit.tar.gz | tar -xz
sudo mv hugo /usr/local/bin/hugo
cd ..
rm -r hugobin
Hi @jmooring,
Sorry for the late follow-up.
It seems to have something to do with parameterless
catchstatements in the newest version of node-fs-extra.
This is a new feature only available in nodejs since 10.3.https://github.com/jprichardson/node-fs-extra/blob/master/lib/mkdirs/make-dir.js#L85
The current Hugo snap bundles a copy of nodejs 8.12.0, so would that be the culprit? I.e., would bundling a newer copy of nodejs in the Hugo snap fix the issue?
@anthonyfok
would bundling a newer copy of nodejs in the Hugo snap fix the issue?
I have no idea. Why don't you give it a try? See "To Reproduce the Issue" in the original issue comment.
Do we have to bundle nodejs? For a Hugo user to use PostCSS they have to install postcss-cli using npm which which requires nodejs. So they already have nodejs installed.
Do we have to bundle nodejs?
For a confinement: strict snap, I believe so. Hugo-as-a-snap cannot access the nodejs outside of the snap.
Please correct me if I am wrong though as it would make things much easier. ;-)
The fix is committed in commit 748fd4c, though admittedly I am not sure if it would solve your problem yet.
Please either:
If the issue isn't really fixed, please re-open this issue and @ me. Thanks!
Most helpful comment
For the workarounds, using hugo binary from github release.