Hugo Pipes fails on Travis CI

Dear all,

first off, I’ve seen this thread but didn’t want to continue there as it was marked solved.

We have quite a similar problem with Travis CI and Hugo Pipes as Hugo breaks on the server while working perfect locally:

$ ./hugo/hugo
Building sites … ERROR 2018/11/28 14:00:54 error: failed to transform resource: TOCSS: failed to transform "scss/app.scss" (text/x-scss): this feature is not available in your current Hugo version
Total in 241 ms
Error: Error building site: logged 1 error(s)
The command "./hugo/hugo" exited with 255.

This is our travis.yml

dist: trusty
sudo: false
language: nodejs
nodejs:
  - "node"

env:
  HUGO=0.50
  URL=https://github.com/gohugoio/hugo/releases/download

before_install:
  - npm install -g n
  - pip install urllib3[secure] awscli --upgrade --user

script:
  # don't build hugo all the time. the easy way would have been:
  # - go get hugo
  # ... but we don't want to build that all the time :)
  - mkdir hugo
  - cd hugo
  - curl -L "${URL}/v${HUGO}/hugo_${HUGO}_Linux-64bit.tar.gz" | gunzip | tar xvf -
  - cd ..
  - ./hugo/hugo
  - '[[ "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = false ]] && aws s3 sync --delete public/ s3://www.tld.com/ || true'

Note that we want to to use PostCSS with Autoprefixer and therefore enabled node.js – not sure actually if something might be wrong with this …

This is our head section

<link href="https://fonts.googleapis.com/css?family=Titillium+Web:300,300i,400,400i,600" rel="stylesheet">
{{ $cssOpts := (dict "targetPath" "css/app.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $styles := resources.Get "scss/app.scss" | toCSS $cssOpts | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">

Any ideas what could be wrong? Your help is much appreciated.

You need to use the Linux Extended version, which includes the Hugo Pipes feature, e.g. hugo_extended_0.52_Linux-64bit.tar.gz


Going off how you’re building the URL now, you could probably edit this

"${URL}/v${HUGO}/hugo_${HUGO}_Linux-64bit.tar.gz"

To be this

"${URL}/v${HUGO}/hugo_extended_${HUGO}_Linux-64bit.tar.gz"

Thank you very much! I’ll give it a try and report back.

Unfortunately this did not work. I’m afraid something is wrong with the server configuration …

$ ./hugo/hugo

./hugo/hugo: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./hugo/hugo)

./hugo/hugo: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./hugo/hugo)

You’ll need to install additional packages using apt-get in your before_install

See https://askubuntu.com/questions/575505/glibcxx-3-4-20-not-found-how-to-fix-this-error

Actually, see this GitHub issue: https://github.com/gohugoio/hugo/issues/5166

Looks like the fix is to build Hugo from source in your .travis.yml

Okay, made a small git repo to test this, in which I build Hugo v0.52 from source.

See my .travis.yml file: https://github.com/zwbetz-gh/travis-ci-hugo-linux-extended/blob/master/.travis.yml

If you want to build a different version of Hugo, then change the commit hash in this line:

- git checkout <hash>

@zwbetz

thank you very much for your quick and helpful advise. i’m in a company environment and operations has concerns with building hugo from source. we will discuss further and i’ll report back. for the moment just wanted to let you know that we’ve read and appreciated your help!

hello @zwbetz, hello everybody,

we got it working by updating our docker container, e. g. updating ubuntu.

fyi here is our travis.yml (note dist:xenial at the very beginning and note the extended version as @zwbetz mentioned ):

dist: xenial
sudo: false
language: node_js
nodejs:
  - "node"

env:
  HUGO=0.51
  URL=https://github.com/gohugoio/hugo/releases/download

before_install:
  - npm install -g n
  - sudo pip install urllib3[secure] awscli --upgrade --user

script:
  # don't build hugo all the time. the easy way would have been:
  # - go get hugo
  # ... but we don't want to build that all the time :)
  - mkdir hugo
  - cd hugo
  - curl -L "${URL}/v${HUGO}/hugo_extended_${HUGO}_Linux-64bit.tar.gz" | gunzip | tar xvf -
  - cd ..
  - ./hugo/hugo
  - '[[ "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = false ]] && aws s3 sync --delete public/ s3://www.tld.com/ || true'

thanks again for the quick replies here!

@totoff Glad you got things working. Yeah in hindsight upgrading the Ubuntu version is a simpler solution.

Also, not sure if you guys plan to use Node.js in your build script, but your syntax is off. It should be something like this:

language: node_js
node_js:
  - "10.14.0"

(Notice the underscore and the specified version)

@zwbetz Thanks for mentioning that. Actually we would like to use Hugo pipes with PostCSS and Autoprefixer. So I think, node is required – but I’m not sure if it really is …

In that case, then yes Node.js is required

Additionally, you need to install PostCSS CLI and Autoprefixer through npm, e.g.

npm install -g postcss-cli
npm install -g autoprefixer

Then you need to specify the Autoprefixer plugin in your postcss.config.js file. See Hugo’s PostCSS docs for more info