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.
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.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error