How to Work Around ghost update pnpm Failures on FreeBSD

Running Ghost on FreeBSD provides unmatched system stability and clean resource usage, but the Node.js ecosystem frequently assumes Linux or macOS environments.

If you have tried updating Ghost recently using ghost update, you likely ran into this brick wall:

Downloading the pnpm binary for freebsd-x64...
Could not download the pnpm binary: Sorry! pnpm does not provide a pre-built binary for freebsd.

Because Ghost-CLI relies heavily on Corepack and pnpm to fetch dependencies, updates halt immediately on FreeBSD. Newer versions of pnpm insist on fetching pre-compiled native binaries that do not exist for BSD architectures. Furthermore, forcing a standard npm install triggers dependency resolution crashes (ERESOLVE) due to peer conflicts between knex and bookshelf.


Here is how to solve this issue permanently using two lightweight wrapper scripts.
Step 1: Intercept Corepack
First, back up your original corepack binary and replace it with a shell wrapper. This prevents Corepack from attempting to fetch non-existent FreeBSD binaries when invoked by Ghost-CLI.

COREPACK_BIN=$(which corepack)
mv "$COREPACK_BIN" "${COREPACK_BIN}.real"
cat << 'EOF' > "$COREPACK_BIN"
#!/bin/sh
if [ "$1" = "pnpm" ]; then
  echo "Bypassing pnpm for FreeBSD: running npm install..."
  exec npm install --omit=dev --ignore-scripts --legacy-peer-deps
fi
exec /usr/local/bin/corepack.real "$@"
EOF
chmod +x "$COREPACK_BIN"

Step 2: Mock pnpm and Reroute to npm
Ghost-CLI checks pnpm -v directly before initiating an update. To satisfy Ghost-CLI's checks while avoiding binary downloads, preserve your original pnpm executable and create a shim in /usr/local/bin/pnpm.

mv /usr/local/bin/pnpm /usr/local/bin/pnpm.orig
cat << 'EOF' > /usr/local/bin/pnpm
#!/bin/sh
if [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
  echo "12.3.4"
  exit 0
fi
echo "Bypassing pnpm for FreeBSD: running npm install..."
exec npm install --omit=dev --ignore-scripts --legacy-peer-deps
EOF
chmod +x /usr/local/bin/pnpm

How It Works

  • Version Spoofing: When Ghost-CLI runs pnpm -v, the wrapper returns a valid version string (12.3.4), passing pre-flight system checks.
  • Rerouted Installation: When Ghost executes pnpm install, the script redirects the command to npm.
  • Dependency Handling: The --legacy-peer-deps flag bypasses strict peer resolution errors between Ghost's internal dependencies without breaking runtime functionality.

Updating Ghost
With both shims active, execute ghost update under your unprivileged ghost user:

su - ghost
ghost update

Ghost-CLI will complete dependency fetching via npm, execute database migrations, and bring your instance online without requiring source modifications or custom CLI forks.