GitHub agent Node version stops Hugo site build

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:

 1Start building sites  
 2hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
 3Error: Error building site: POSTCSS: failed to transform "css/style.css" (text/css): node:internal/errors:478
 4    ErrorCaptureStackTrace(err);
 5    ^
 6
 7SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_homedir returned ENOENT (no such file or directory)
 8    at Object.<anonymous> (/opt/nodejs/16.18.0/lib/node_modules/npm/node_modules/clean-stack/index.js:6:61)
 9    at Module._compile (node:internal/modules/cjs/loader:1155:14)
10    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
11    at Module.load (node:internal/modules/cjs/loader:1033:32)
12    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
13    at Module.require (node:internal/modules/cjs/loader:1057:19)
14    at require (node:internal/modules/cjs/helpers:103:18)
15    at Object.<anonymous> (/opt/nodejs/16.18.0/lib/node_modules/npm/node_modules/aggregate-error/index.js:3:20)
16    at Module._compile (node:internal/modules/cjs/loader:1155:14)
17    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) {
18  code: 'ERR_SYSTEM_ERROR',
19  info: {
20    errno: -2,
21    code: 'ENOENT',
22    message: 'no such file or directory',
23    syscall: 'uv_os_homedir'
24  },
25  errno: [Getter/Setter],
26  syscall: [Getter/Setter]
27}
28Total 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.

 1jobs:
 2  build_and_deploy_job:
 3    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
 4    runs-on: ubuntu-latest
 5    name: Build and Deploy Job
 6    env:
 7      HUGO_VERSION: 0.108.0
 8      NODE_VERSION: 14
 9    steps:
10     ....

Once this was set the build worked as expected.