Skip to content

fix(deps): add missing sharp dependencies#593

Open
kadams54 wants to merge 1 commit intoColeMurray:mainfrom
CompanyCam:kadams54/sharp-deps
Open

fix(deps): add missing sharp dependencies#593
kadams54 wants to merge 1 commit intoColeMurray:mainfrom
CompanyCam:kadams54/sharp-deps

Conversation

@kadams54
Copy link
Copy Markdown

@kadams54 kadams54 commented May 4, 2026

Fixes #524

Summary by CodeRabbit

  • Chores
    • Added two development dependencies to the project: node-addon-api and node-gyp, to support the build environment.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3960199e-873e-47bf-988a-544a3f1626c0

📥 Commits

Reviewing files that changed from the base of the PR and between 91d3fc2 and 635098b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json

📝 Walkthrough

Walkthrough

Two development dependencies, node-addon-api@^8.7.0 and node-gyp@^12.2.0, were added to devDependencies in package.json.

Changes

Dependency addition for native module build

Layer / File(s) Summary
Dev Dependencies
package.json
Added node-addon-api@^8.7.0 and node-gyp@^12.2.0 to devDependencies.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I nudged two deps into place with care,
node-addon-api and node-gyp in the air.
Sharp stopped sighing, the build took flight,
Hops of joy through morning light. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(deps): add missing sharp dependencies' accurately reflects the main change of adding node-gyp and node-addon-api as dev dependencies to resolve sharp build failures.
Linked Issues check ✅ Passed The code changes directly address issue #524 by adding node-gyp and node-addon-api as devDependencies, matching the exact solution that resolved the sharp build error for the reporter.
Out of Scope Changes check ✅ Passed The pull request contains only the two necessary dev dependencies additions and no other unrelated changes to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kadams54 kadams54 force-pushed the kadams54/sharp-deps branch from 91d3fc2 to 635098b Compare May 4, 2026 21:08
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
package.json (1)

31-32: ⚡ Quick win

This fix may be insufficient when libvips is globally installed (e.g. via brew install vips) on Node 24.

When libvips is globally installed, sharp detects it and attempts to build from source instead of using prebuilt binaries. This build fails on Node.js 24 LTS with a C++ compilation error (NewOrCopy not found in Napi::Buffer) — an error that adding node-addon-api does not resolve. The workaround for that case is SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install, which forces the prebuilt binary download.

Consider documenting this environment-specific workaround in the README or .env.example, and/or adding it to an .npmrc:

sharp_ignore_global_libvips=true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 31 - 32, The package.json change adding
node-addon-api/node-gyp doesn't address failures when libvips is globally
installed and sharp builds from source on Node 24; update docs and config to
document and enforce the workaround by (a) adding a note to README and
.env.example explaining to set SHARP_IGNORE_GLOBAL_LIBVIPS=1 before npm install
when brew/other global libvips is present, and (b) add an .npmrc entry
sharp_ignore_global_libvips=true to force use of prebuilt sharp binaries during
install; reference the package.json dependency names (node-addon-api, node-gyp)
and the env var SHARP_IGNORE_GLOBAL_LIBVIPS in the documentation so maintainers
know why this is needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 31-32: Update the root package.json devDependency "node-gyp" from
"^12.2.0" to "^12.3.0": locate the "node-gyp" entry in package.json and change
its version string to "^12.3.0", then run your package manager (npm/yarn/pnpm)
to refresh the lockfile and install updated devDependencies so the repo uses
node-gyp 12.3.0.

---

Nitpick comments:
In `@package.json`:
- Around line 31-32: The package.json change adding node-addon-api/node-gyp
doesn't address failures when libvips is globally installed and sharp builds
from source on Node 24; update docs and config to document and enforce the
workaround by (a) adding a note to README and .env.example explaining to set
SHARP_IGNORE_GLOBAL_LIBVIPS=1 before npm install when brew/other global libvips
is present, and (b) add an .npmrc entry sharp_ignore_global_libvips=true to
force use of prebuilt sharp binaries during install; reference the package.json
dependency names (node-addon-api, node-gyp) and the env var
SHARP_IGNORE_GLOBAL_LIBVIPS in the documentation so maintainers know why this is
needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b90b79f2-d9d4-4458-8030-1625b894d333

📥 Commits

Reviewing files that changed from the base of the PR and between cd68977 and 91d3fc2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json

Comment thread package.json
Comment on lines +31 to +32
"node-addon-api": "^8.7.0",
"node-gyp": "^12.2.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find which workspace package(s) declare sharp as a dependency
rg -l '"sharp"' --glob 'packages/*/package.json' -n
rg '"sharp"' --glob 'packages/*/package.json' -n -A1 -B1

Repository: ColeMurray/background-agents

Length of output: 54


🏁 Script executed:

# First, check if sharp exists anywhere in the root package.json or dependencies
rg '"sharp"' . -g 'package.json' -i

Repository: ColeMurray/background-agents

Length of output: 54


🏁 Script executed:

# Check what the actual root package.json looks like (full content)
cat package.json

Repository: ColeMurray/background-agents

Length of output: 1623


🏁 Script executed:

# Check if there's a lockfile that might reveal sharp as a transitive dependency
ls -la | grep -E 'package-lock|yarn.lock|pnpm-lock'

Repository: ColeMurray/background-agents

Length of output: 142


🌐 Web query:

node-gyp latest version npm

💡 Result:

The latest version of node-gyp on npm is 12.3.0, published on April 21, 2026 [1][2][3]. This is confirmed by the official npm registry page listing it as the current version [1], the npmjs.com package page [3], and the GitHub releases page [2]. Some cached or older pages show 12.2.0 [4][5][6], but the most recent authoritative sources indicate 12.3.0 as latest today (2026-05-04). To install: npm install node-gyp@latest or npm install -g node-gyp [7].

Citations:


🌐 Web query:

node-addon-api latest version 8.7.0

💡 Result:

The latest version of node-addon-api is 8.7.0, released on March 26, 2026.[1][2][3][4][5] This is confirmed across official sources including the npm registry, npmjs.com, GitHub releases page, and the main repository homepage. The GitHub releases list shows v8.7.0 as the most recent tag with features like Date::New overload, Object::GetPrototype/SetPrototype, and SharedArrayBuffer support in DataViews.[4] Earlier versions like v8.6.0 (Feb 27, 2026) and v8.5.0 (Jul 14, 2025) precede it.[1][2]

Citations:


Update node-gyp to the latest version ^12.3.0.

The version pinned in root devDependencies is outdated. node-gyp latest is 12.3.0 (released April 21, 2026), not 12.2.0. Update the entry on line 32 to "node-gyp": "^12.3.0".

The recommendation in the original comment to move these dependencies to a specific workspace package is not applicable, as sharp is not declared as a direct dependency in any workspace package in the codebase.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 31 - 32, Update the root package.json
devDependency "node-gyp" from "^12.2.0" to "^12.3.0": locate the "node-gyp"
entry in package.json and change its version string to "^12.3.0", then run your
package manager (npm/yarn/pnpm) to refresh the lockfile and install updated
devDependencies so the repo uses node-gyp 12.3.0.

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.

Sharp's node-gyp & node-addon-api dependencies

1 participant