macOS ARM Local installation issues

I am unable to install Ghost locally.

I ran the following steps:

  1. Ran npm install ghost-cli@latest -g
  2. Created an arbitrary directory
  3. Ran ghost install local

The installation fails and I am really struggling to debug it. My error log is shown below:

Debug Information:
    OS: macOS, v12.6
    Node Version: v16.17.0
    Ghost-CLI Version: 1.23.1
    Environment: development
    Command: 'ghost install local'
Message: Command failed: yarn install --no-emoji --no-progress
warning ghost@5.18.0: The engine "cli" appears to be invalid.
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.29.4"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@0.5.34"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.3"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.33"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.27.0"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.31"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "@tryghost/logging@2.3.2" is incompatible with requested version "@tryghost/logging@2.2.3"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning "@tryghost/kg-lexical-html-renderer > @lexical/rich-text@0.4.1" has unmet peer dependency "@lexical/selection@0.4.1".
warning "@tryghost/kg-lexical-html-renderer > @lexical/rich-text@0.4.1" has unmet peer dependency "@lexical/utils@0.4.1".
warning " > bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0".
warning " > mock-knex@0.4.9" has incorrect peer dependency "knex@> 0.8 < 2.1".
warning Workspaces can only be enabled in private projects.
error /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2: Command failed.
Exit code: 1
Command: install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || npm run rebuild
Arguments: 
Directory: /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2
Output:
Trying https://github.com/uhop/node-re2/releases/download/1.17.7/darwin-arm64-93.br ...
Trying https://github.com/uhop/node-re2/releases/download/1.17.7/darwin-arm64-93.gz ...
Building locally ...

> re2@1.17.7 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@16.17.0 | darwin | arm64
gyp info find Python using Python version 3.9.1 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/Library/Caches/node-gyp/13.5.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ruanspies/Library/Caches/node-gyp/13.5.2',
gyp info spawn args   '-Dnode_gyp_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ruanspies/Library/Caches/node-gyp/13.5.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/lib/configure.js:284:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/usr/local/bin/node" "/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok 
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "1".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

> re2@1.17.7 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@16.17.0 | darwin | arm64
gyp info find Python using Python version 3.9.1 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/Library/Caches/node-gyp/13.5.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ruanspies/Library/Caches/node-gyp/13.5.2',
gyp info spawn args   '-Dnode_gyp_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ruanspies/Library/Caches/node-gyp/13.5.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/lib/configure.js:284:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/usr/local/bin/node" "/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok
warning Error running install script for optional dependency: "/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments: 
Directory: /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp
Output:
sharp: Using cached /Users/ruanspies/.npm/_libvips/libvips-8.12.2-darwin-arm64v8.tar.br
sharp: Integrity check passed for darwin-arm64v8
gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@16.17.0 | darwin | arm64
gyp info find Python using Python version 3.9.1 found at \"/usr/local/bin/python3\"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/Library/Caches/node-gyp/13.5.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ruanspies/Library/Caches/node-gyp/13.5.2',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ruanspies/Library/Caches/node-gyp/13.5.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != \"\"' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command \"/usr/local/bin/node\" \"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok"

yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
info This module is OPTIONAL, you can safely ignore this error

Exit code: 1

--------------- stdout ---------------
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
info This module is OPTIONAL, you can safely ignore this error


--------------- stderr ---------------
warning ghost@5.18.0: The engine "cli" appears to be invalid.
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.29.4"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@0.5.34"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.29.1"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.3"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.33"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.27.0"
warning Resolution field "moment-timezone@0.5.23" is incompatible with requested version "moment-timezone@^0.5.31"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@2.27.0"
warning Resolution field "@tryghost/logging@2.3.2" is incompatible with requested version "@tryghost/logging@2.2.3"
warning Resolution field "moment@2.24.0" is incompatible with requested version "moment@^2.29.1"
warning "@tryghost/kg-lexical-html-renderer > @lexical/rich-text@0.4.1" has unmet peer dependency "@lexical/selection@0.4.1".
warning "@tryghost/kg-lexical-html-renderer > @lexical/rich-text@0.4.1" has unmet peer dependency "@lexical/utils@0.4.1".
warning " > bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0".
warning " > mock-knex@0.4.9" has incorrect peer dependency "knex@> 0.8 < 2.1".
warning Workspaces can only be enabled in private projects.
error /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2: Command failed.
Exit code: 1
Command: install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || npm run rebuild
Arguments: 
Directory: /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2
Output:
Trying https://github.com/uhop/node-re2/releases/download/1.17.7/darwin-arm64-93.br ...
Trying https://github.com/uhop/node-re2/releases/download/1.17.7/darwin-arm64-93.gz ...
Building locally ...

> re2@1.17.7 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@16.17.0 | darwin | arm64
gyp info find Python using Python version 3.9.1 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/Library/Caches/node-gyp/13.5.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ruanspies/Library/Caches/node-gyp/13.5.2',
gyp info spawn args   '-Dnode_gyp_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ruanspies/Library/Caches/node-gyp/13.5.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/lib/configure.js:284:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/usr/local/bin/node" "/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok 
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "1".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

> re2@1.17.7 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@16.17.0 | darwin | arm64
gyp info find Python using Python version 3.9.1 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/Library/Caches/node-gyp/13.5.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ruanspies/Library/Caches/node-gyp/13.5.2',
gyp info spawn args   '-Dnode_gyp_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ruanspies/Library/Caches/node-gyp/13.5.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/node-gyp/lib/configure.js:284:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/usr/local/bin/node" "/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/re2
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok
warning Error running install script for optional dependency: "/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments: 
Directory: /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp
Output:
sharp: Using cached /Users/ruanspies/.npm/_libvips/libvips-8.12.2-darwin-arm64v8.tar.br
sharp: Integrity check passed for darwin-arm64v8
gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@16.17.0 | darwin | arm64
gyp info find Python using Python version 3.9.1 found at \"/usr/local/bin/python3\"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ruanspies/Library/Caches/node-gyp/13.5.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ruanspies/Library/Caches/node-gyp/13.5.2',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ruanspies/Library/Caches/node-gyp/13.5.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != \"\"' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command \"/usr/local/bin/node\" \"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /Users/ruanspies/test/ghost/versions/5.18.0/node_modules/sharp
gyp ERR! node -v v16.17.0
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok"

Fixed by reverting back to Node v14, as per the post below: