npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

retold-sharp

v1.0.0

Published

Wrapper around the sharp image library that bypasses sharp's global-libvips detection at install time, so machines with Homebrew or system libvips don't fall into the build-from-source path.

Readme

retold-sharp

Drop-in wrapper around sharp that bypasses sharp's global-libvips detection at install time.

Why this exists

Sharp's installer treats the presence of a system libvips (e.g. via Homebrew, apt, or an ML pipeline) as a signal that the user wants to compile sharp from source. On a machine where libvips was installed for unrelated reasons, this triggers a build path that fails with a misleading Please add node-addon-api to your dependencies error.

Sharp exposes an opt-out — SHARP_IGNORE_GLOBAL_LIBVIPS=1 — but the env var must be set before npm install runs sharp's lifecycle script, and there's no clean way to pin that at the project level via .npmrc or package.json.

retold-sharp solves this by installing sharp itself, in its own install lifecycle script, with the env var injected into the child process. Consumers depend on retold-sharp instead of sharp and get a working sharp regardless of what's on the host.

Use

const libSharp = require('retold-sharp');

libSharp('input.jpg').resize(300, 200).toFile('out.jpg');

The default export is the sharp constructor — anywhere require('sharp') works, require('retold-sharp') works the same way.

Diagnostic helpers

const libSharp = require('retold-sharp');

libSharp.checkAvailable();
//  => { available: true, mode: 'native', versions: { sharp, vips, ... }, error: null }

libSharp.getMode();
//  => 'native' | 'wasm' | null

checkAvailable() runs a 1×1 pixel smoke test synchronously — it catches the case where the sharp module loads but the underlying binary won't run (the classic Synology/odd-arch failure mode).

Power user mode

If sharp is already resolvable from your project (because you installed it yourself, perhaps with a custom libvips build), retold-sharp detects that at install time and skips its own bootstrap. The runtime passthrough also walks up the standard node_modules chain, so your copy wins.

Skip the bootstrap

RETOLD_SHARP_SKIP_INSTALL=1 skips the bootstrap entirely — useful for CI that primes its own node_modules cache, or for environments without network access during install.

Pinning sharp's version

The pinned sharp version lives in this package's package.json under config.sharpVersion. Bump that one line to upgrade sharp across every Retold consumer.

Example application

A Pict-based playground lives at example_applications/sharp_playground/. To run it:

cd example_applications/sharp_playground
npm install
npm run build           # bundle the Pict app into dist/
npm start               # serves dist/ + the /api/* sharp endpoints on :7780

Or from the retold-sharp root:

npm run example         # → npx quack examples (builds + serves the static index)

Note: npx quack examples serves only the static UI shell. For the live image operations, run npm start from inside example_applications/sharp_playground/ — that boots the Node API server backed by retold-sharp.