Skip to content

Sharp fails to load on older CPUs after upgrading to Ghost 6.x (x86-64-v2 microarchitecture requirement) #27446

@aral190

Description

@aral190

Issue Summary

Environment

  • OS: Ubuntu 22.04.5 LTS
  • Ghost Version: 6.30.0
  • Ghost-CLI Version: 1.26.1
  • Node Version: v22.22.2
  • sharp Version: 0.34.5
  • Environment: production

Description

After upgrading from Ghost 5.x (Node 18) to Ghost 6.x (Node 22), image processing fails (Error message: "Image processing failed Sharp wasn't installed") with the following error when attempting to upload images (e.g. post header images):

Error: Could not load the "sharp" module using the linux-x64 runtime
Unsupported CPU: Prebuilt binaries for linux-x64 require v2 microarchitecture

Expected Behaviour

Ghost 6.x should either:

  • Ship a fallback for sharp that builds from source on older CPUs, or
  • Detect the incompatible CPU at startup and log a clear, actionable warning (e.g. "Your CPU does not support the prebuilt sharp binary — please run npm rebuild sharp --build-from-source"), or
  • Document this requirement explicitly in the Ghost 6.x upgrade guide and Node version docs

Actual Behaviour

Ghost starts without any warning about the CPU incompatibility. Image uploads silently fail with a generic Image processing failed - Sharp wasn't installed message in the admin UI, with the actual root cause (CPU microarchitecture) only visible via node -e "require('sharp')".

Additional Context

  • This affects servers running on older hardware or VPS providers that expose older CPU profiles (x86-64-v1)
  • sharp 0.34.x introduced the x86-64-v2 requirement; previous versions (e.g. 0.32.x) did not have this restriction
  • Ghost 6.x also introduced pnpm as the package manager (replacing npm), which is not documented prominently in the upgrade path and causes a spawn pnpm ENOENT error if pnpm is not installed before running ghost update
  • Workaround: build sharp from source via npm install --build-from-source sharp (slow, requires libvips-dev) or downgrade to sharp 0.32.x (untested with Ghost 6.x)

Suggested Fix

Add a ghost doctor check or startup check that detects whether the installed sharp binary is compatible with the host CPU, and surfaces a clear error with remediation steps rather than a silent failure at image upload time.

Steps to Reproduce

  1. Run Ghost 6.x on a server with an older CPU that does not support x86-64-v2 microarchitecture
  2. Attempt to upload any image (e.g. a post header image)
  3. Ghost reports: Image processing failed - Sharp wasn't installed

Ghost Version

6.30.0

Node.js Version

v22.22.2

How did you install Ghost?

Ubuntu 22.04.5 LTS

Database type

MySQL 8

Browser & OS version

brace

Relevant log / error output

/var/www/ghost/versions/6.30.0/node_modules/.pnpm/sharp@0.34.5/node_modules/sharp/lib/sharp.js:120
  throw new Error(help.join('\n'));
  ^
Error: Could not load the "sharp" module using the linux-x64 runtime
Unsupported CPU: Prebuilt binaries for linux-x64 require v2 microarchitecture
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
- Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
    npm install --os=linux --cpu=x64 sharp
- Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install

Code of Conduct

  • I agree to be friendly and polite to people in this repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs:triage[triage] this needs to be triaged by the Ghost team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions