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.
Fixes npm ERR! sharp: Installation error: package 'vips' could not be found
sudo apt-get update
sudo apt-get install -y libvips-devsudo apt-get updatesudo apt-get install -y libvips-devnpm ERR! sharp: Installation error: package 'vips' could not be found
On this page
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.
Install libvips and its development headers:
sudo apt-get update
sudo apt-get install -y libvips-devFor newer libvips versions (8.13+):
sudo apt-get install -y libvips-toolsFor Red Hat-based systems:
sudo yum install -y vips-develNote: CentOS 7 has an older vips. Consider using Remi's repository for newer versions:
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-develFor Alpine Linux (Docker):
apk add --no-cache vips-dev build-baseFor runtime only (after build):
apk add --no-cache vipsSharp can download prebuilt binaries. Ensure network access and try:
npm install sharp --ignore-scripts
npx sharp-cli installOr set the platform explicitly:
npm install --platform=linux --arch=x64 sharpIf libvips was installed after sharp, rebuild:
npm rebuild sharpOr clean install:
rm -rf node_modules/sharp
npm install sharpFor Docker multi-stage builds:
# 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:
npm install --arch=arm64 sharpIf you're behind a corporate proxy, the binary download may fail. Set npm proxy settings or install libvips locally.