Skip to content

build: add node-gyp to devDependencies to resolve sharp source-build failures - #2538

Open
abstraction wants to merge 1 commit into
jackyzha0:v5from
abstraction:build-sharp-dependencies
Open

build: add node-gyp to devDependencies to resolve sharp source-build failures#2538
abstraction wants to merge 1 commit into
jackyzha0:v5from
abstraction:build-sharp-dependencies

Conversation

@abstraction

Copy link
Copy Markdown

Current behavior

I hit a hard crash running npm i on Node LTS. Turns out if you have libvips installed, sharp skips the prebuilt binaries. It tries to compile from source instead.

pm error code 1
npm error path /home/abstraction/code/quartz/node_modules/sharp
npm error command failed
npm error command sh -c node install/check.js || npm run build
npm error > sharp@0.34.5 build
npm error > node install/build.js
npm error
npm error sharp: Attempting to build from source via node-gyp
npm error sharp: See https://sharp.pixelplumbing.com/install#building-from-source
npm error sharp: Found node-addon-api
npm error sharp: Please add node-gyp to your dependencies
npm error A complete log of this run can be found in: /home/abstraction/.npm/_logs/2026-08-27T02_49_41_353Z-debug-0.log

Quartz already pulls in node-addon-api as a dependency through @parcel/watcher (ref). Sharp finds it without an issue. But node-gyp is missing entirely.

This completely breaks setup if the user's system forces a source build.

Expected behavior

Users can run npm i or pnpm i and get a working setup out of the box.

Solution

I added node-gyp to devDependencies. I left node-addon-api out because @parcel/watcher already brings it into the tree, and the sharp build succeeds with it as-is.

Pulling in node-gyp adds some weight to the initial install. But it stops the setup from crashing for common dev environments (mac too, i guess).

Environment

  • Node version: 24.20.0 (LTS) and 26.7.0 (checked as well)
  • OS: Arch (7.1.8-arch1-3)
  • Package manager: npm and pnpm

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
quartz ✅ Ready (View Log) Visit Preview dde005f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant