The Problem
I have blogged previously about moving various web sites over to become Hugo Static Sites.
Recently one of my site’s, one using the tailwindscss module, GitHub Build and Deployment Workflow started failing with the following error:
Start building sites …
hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/style.css" (text/css): node:internal/errors:478
ErrorCaptureStackTrace(err);
^
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_homedir returned ENOENT (no such file or directory)
at Object.<anonymous> (/opt/nodejs/16.18.0/lib/node_modules/npm/node_modules/clean-stack/index.js:6:61)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/opt/nodejs/16.18.0/lib/node_modules/npm/node_modules/aggregate-error/index.js:3:20)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) {
code: 'ERR_SYSTEM_ERROR',
info: {
errno: -2,
code: 'ENOENT',
message: 'no such file or directory',
syscall: 'uv_os_homedir'
},
errno: [Getter/Setter],
syscall: [Getter/Setter]
}
Total in 1653 ms
Solution
The problem it turned out was that the default version of Node used by the GitHub Actions runner had changed from Node 14 to Node 16.
I needed to explicitly set the version of Node to use in the workflow file to Node 14.
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
env:
HUGO_VERSION: 0.108.0
NODE_VERSION: 14
steps:
....
Once this was set the build worked as expected.