From cloudflare-macos-fix
Fix sharp native module installation failure on macOS Apple Silicon when setting up Cloudflare Workers projects using wrangler. Use when the user encounters "sharp", "wrangler install", "pnpm install" errors on macOS arm64/Apple Silicon with Node v25+, or when setting up a new Cloudflare Workers project on macOS. Trigger on keywords: "sharp", "wrangler", "cloudflare workers setup", "native module", "darwin-arm64", "prebuilt binary", "node-gyp", "ABI mismatch".
npx claudepluginhub jaeyeom/claude-toolbox --plugin cloudflare-macos-fixThis skill uses the workspace's default tool permissions.
The `sharp` package (transitive dependency of `wrangler`) fails to install on
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
The sharp package (transitive dependency of wrangler) fails to install on
macOS Apple Silicon (darwin-arm64) with Node v25+. Sharp 0.34.x ships prebuilt
binaries that have an ABI mismatch with Node v25's native .node files.
Typical error symptoms:
sharp install fails during pnpm install / npm installdarwin-arm64node-gyp rebuild failures for sharpAdd to package.json:
"pnpm": {
"overrides": {
"sharp": "0.33.5"
}
}
For npm, use overrides at the top level instead:
"overrides": {
"sharp": "0.33.5"
}
.npmrc with platform-specific binary configCreate or update .npmrc:
shamefully-hoist=true
supportedArchitectures.os=current
supportedArchitectures.cpu=current
supportedArchitectures.libc=current
This tells pnpm to download prebuilt native binaries matching the current platform only.
node-addon-api as a devDependencypnpm add -D node-addon-api@^8.3.1
Fallback so sharp can compile from source if prebuilt binaries aren't available.
rm -rf node_modules pnpm-lock.yaml
pnpm install
sharp as transitive dependency via wrangler