How to fix npm ERR! sharp: Installation error: package 'vips' could not be found in npm

npmINTERMEDIATEMEDIUMUpdated Dec 3, 2025ยท 141 views

This error occurs when installing the sharp image processing library without libvips. Install libvips development files for your Linux distribution or use sharp's prebuilt binaries.

Quick fix

Fixes npm ERR! sharp: Installation error: package 'vips' could not be found

sudo apt-get update
sudo apt-get install -y libvips-dev
  1. Install libvips on Ubuntu/Debian
  2. Install libvips on CentOS/RHEL
  3. Install libvips on Alpine
  4. Force prebuilt binary download
npm โ€” error
sudo apt-get update
sudo apt-get install -y libvips-dev
npm ERR! sharp: Installation error: package 'vips' could not be found

What this error means

Sharp is a high-performance Node.js image processing library built on libvips. When npm can't find prebuilt binaries for your platform or they fail to work, it attempts to build from source and requires libvips to be installed. libvips is a fast image processing library written in C. Sharp needs either prebuilt binaries (which it tries first) or the libvips development files to compile against. This error typically occurs on less common platforms, older systems, or when network issues prevent downloading prebuilt binaries.

Typical symptoms

  • npm install sharp fails with vips not found error
  • Error occurs during postinstall script
  • Works on macOS/Windows but fails on Linux servers
  • CI/CD builds fail when sharp is added
  • Docker builds fail during npm install

Common causes

  1. libvips is not installed on the system
  2. Prebuilt binaries unavailable for your platform/architecture
  3. Network issues preventing prebuilt binary download
  4. pkg-config can't find libvips even when installed
  5. libvips version too old for sharp requirements

How to fix "npm ERR! sharp: Installation error: package 'vips' could not be found"

1Install libvips on Ubuntu/Debian

Install libvips and its development headers:

bash
sudo apt-get update
sudo apt-get install -y libvips-dev

For newer libvips versions (8.13+):

bash
sudo apt-get install -y libvips-tools
2Install libvips on CentOS/RHEL

For Red Hat-based systems:

bash
sudo yum install -y vips-devel

Note: CentOS 7 has an older vips. Consider using Remi's repository for newer versions:

bash
sudo yum install -y epel-release
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum --enablerepo=remi install -y vips-devel
3Install libvips on Alpine

For Alpine Linux (Docker):

bash
apk add --no-cache vips-dev build-base

For runtime only (after build):

bash
apk add --no-cache vips
4Force prebuilt binary download

Sharp can download prebuilt binaries. Ensure network access and try:

bash
npm install sharp --ignore-scripts
npx sharp-cli install

Or set the platform explicitly:

bash
npm install --platform=linux --arch=x64 sharp
5Rebuild sharp after installing libvips

If libvips was installed after sharp, rebuild:

bash
npm rebuild sharp

Or clean install:

bash
rm -rf node_modules/sharp
npm install sharp

Advanced notes

For Docker multi-stage builds:

dockerfile
# Build stage
FROM node:20-alpine AS builder
RUN apk add --no-cache vips-dev build-base
WORKDIR /app
COPY package*.json ./
RUN npm ci

# Production stage
FROM node:20-alpine
RUN apk add --no-cache vips
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .

Sharp supports these platforms with prebuilt binaries:
- linux-x64 (glibc, musl)
- linux-arm64 (glibc, musl)
- darwin-x64, darwin-arm64
- win32-x64

For ARM systems (Raspberry Pi), ensure you use the correct architecture:

bash
npm install --arch=arm64 sharp

If you're behind a corporate proxy, the binary download may fail. Set npm proxy settings or install libvips locally.

Frequently asked questions

What does "npm ERR! sharp: Installation error: package 'vips' could not be found" mean?
js image processing library built on libvips. When npm can't find prebuilt binaries for your platform or they fail to work, it attempts to build from source and requires libvips to be installed. libvips is a fast image processing library written in C.
How do I fix "npm ERR! sharp: Installation error: package 'vips' could not be found"?
This error occurs when installing the sharp image processing library without libvips. Install libvips development files for your Linux distribution or use sharp's prebuilt binaries.
What causes "npm ERR! sharp: Installation error: package 'vips' could not be found"?
libvips is not installed on the system Prebuilt binaries unavailable for your platform/architecture Network issues preventing prebuilt binary download
Is the "npm ERR! sharp: Installation error: package 'vips' could not be found" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading