Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postcss error with snap install of Hugo 0.70 #7278

Closed
jmooring opened this issue May 15, 2020 · 11 comments
Closed

Postcss error with snap install of Hugo 0.70 #7278

jmooring opened this issue May 15, 2020 · 11 comments
Labels

Comments

@jmooring
Copy link
Member

jmooring commented May 15, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.70.0/extended linux/amd64 BuildDate: 2020-05-13T17:30:34Z

Does this issue reproduce with the latest release?

Yes.

Environment

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal

To Reproduce the Issue

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)
@jmooring
Copy link
Member Author

Discussion from the Hugo support queue:
https://discourse.gohugo.io/t/postcss-error-building-site-since-yesterday/25513

@jerodev
Copy link

jerodev commented May 19, 2020

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

@canvural
Copy link

My Node version is 12.16.2 and still happens. Any workarounds?

@jmooring
Copy link
Member Author

jmooring commented May 25, 2020

Also reproducible with snap installation of Hugo Static Site Generator v0.71.1/extended linux/amd64 BuildDate: 2020-05-25T13:06:06Z.

@jmooring
Copy link
Member Author

jmooring commented Jun 1, 2020

Also reproducible with snap installation of Hugo Static Site Generator v0.72.0/extended linux/amd64 BuildDate: 2020-05-31T18:10:04Z

@blackb1rd
Copy link

blackb1rd commented Jun 14, 2020

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

@anthonyfok
Copy link
Member

Hi @jmooring,

Sorry for the late follow-up.

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

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?

@jmooring
Copy link
Member Author

@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.

@anthonyfok
Copy link
Member

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. ;-)

@anthonyfok
Copy link
Member

The fix is committed in commit 748fd4c, though admittedly I am not sure if it would solve your problem yet.

Please either:

  • wait a day or two, then install the latest the Hugo snap from the edge channel, or
  • wait until the next Hugo release (0.75.0?) when its snap is released to the stable channel.

If the issue isn't really fixed, please re-open this issue and @ me. Thanks!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants