Skip to content

refactor: Use napi-rs/image instead of sharp for screenshots#28586

Merged
Cadiac merged 1 commit intomasterfrom
computer-use-sharp-build-issue
Apr 21, 2026
Merged

refactor: Use napi-rs/image instead of sharp for screenshots#28586
Cadiac merged 1 commit intomasterfrom
computer-use-sharp-build-issue

Conversation

@Cadiac
Copy link
Copy Markdown
Contributor

@Cadiac Cadiac commented Apr 16, 2026

Summary

npx @n8n/computer-use ... commands failed silently with exit 1 on machines that have a system-wide libvips (e.g. installed via homebrew). Sharp's install script (useGlobalLibvips()in sharp/lib/libvips.js) detects a compatible system libvips and prefers to build from source against it - but building requires node-gyp, which isn't in sharp's deps. npx swallows the install error, so the user sees no banner, no logs, and no clue what went wrong.

I did consider adding node-gyp as a dependency but decided against it as that bundles a full C++ toolchain footprint for what amounts to one toJpeg helper.

@napi-rs/image (MIT) is a pure-Rust image library with statically linked prebuilds per platform. It has no system-library detection path and no build-from-source fallback, so install either succeeds with a prebuilt binary or fails loudly. Prebuild coverage is equivalent to sharp for our use case (desktop tool: macOS arm64/x64, Windows x64/arm64, Linux x64/arm64 glibc+musl). Admittedly I have no experience from using this library before, but napi-rs ecosystem seems reasonably actively developed.

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown
Contributor

Performance Comparison

Comparing currentlatest master14-day baseline

Idle baseline with Instance AI module loaded

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
instance-ai-heap-used-baseline 186.75 MB 186.90 MB 186.41 MB (σ 0.28) -0.1% +0.2% ⚠️
instance-ai-rss-baseline 344.71 MB 345.77 MB 365.35 MB (σ 23.65) -0.3% -5.7%

Memory consumption baseline with starter plan resources

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
memory-heap-used-baseline 114.54 MB 114.54 MB 114.13 MB (σ 0.52) +0.0% +0.4%
memory-rss-baseline 332.36 MB 332.36 MB 289.78 MB (σ 45.79) +0.0% +14.7%

docker-stats

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
docker-image-size-runners 386.00 MB 393.00 MB 391.78 MB (σ 10.35) -1.8% -1.5%
docker-image-size-n8n 1269.76 MB 1269.76 MB 1269.76 MB (σ 0.00) +0.0% +0.0%
How to read this table
  • Current: This PR's value (or latest master if PR perf tests haven't run)
  • Latest Master: Most recent nightly master measurement
  • Baseline: Rolling 14-day average from master
  • vs Master: PR impact (current vs latest master)
  • vs Baseline: Drift from baseline (current vs rolling avg)
  • Status: ✅ within 1σ | ⚠️ 1-2σ | 🔴 >2σ regression

@Cadiac Cadiac marked this pull request as ready for review April 20, 2026 08:22
@Cadiac Cadiac requested a review from dlavrenuek April 20, 2026 08:22
@Cadiac
Copy link
Copy Markdown
Contributor Author

Cadiac commented Apr 20, 2026

I'll test this a bit now to ensure it works, this didn't get enough testing last week.

@dlavrenuek
Copy link
Copy Markdown
Contributor

Works perfectly, thank you @Cadiac 🚀

@Cadiac
Copy link
Copy Markdown
Contributor Author

Cadiac commented Apr 20, 2026

Also tested earlier locally that this did in fact did the issue I was seeing on my machine

@n8n-assistant n8n-assistant Bot added community Authored by a community member node/improvement New feature or request labels Apr 20, 2026
@dlavrenuek
Copy link
Copy Markdown
Contributor

Looks like I clicked on "comment" instead of "approve" last time 🙈

@Cadiac Cadiac added this pull request to the merge queue Apr 21, 2026
Merged via the queue into master with commit cb1244c Apr 21, 2026
65 of 66 checks passed
@Cadiac Cadiac deleted the computer-use-sharp-build-issue branch April 21, 2026 09:17
@n8n-assistant
Copy link
Copy Markdown
Contributor

n8n-assistant Bot commented Apr 28, 2026

Got released with n8n@2.19.0

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

Labels

community Authored by a community member node/improvement New feature or request Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants