3.7 KiB
Installation
npm install sharp
Prerequisites
- Node.js v0.10+ or io.js
- libvips v7.40.0+ (7.42.0+ recommended)
- C++11 compatible compiler such as gcc 4.6+, clang 3.0+ or MSVC 2013 (io.js v3+ requires gcc 4.8+)
Linux
For a system-wide installation of the most suitable version of libvips and its dependencies on the following Operating Systems:
- Debian 7, 8
- Ubuntu 12.04, 14.04, 14.10, 15.04, 15.10
- Mint 13, 17
- Elementary 0.3
- RHEL/Centos/Scientific 6, 7
- Fedora 21, 22
- Amazon Linux 2015.03, 2015.09
- OpenSuse 13
run the following as a user with sudo
access:
curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash -
or run the following as root
:
curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | bash -
The preinstall.sh script requires curl
and pkg-config
.
Add --with-openslide
to enable OpenSlide support:
curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash -s -- --with-openslide
Ubuntu LTS
libvips v7.40.6 is available via a PPA.
12.04
sudo add-apt-repository -y ppa:lovell/precise-backport-vips
sudo apt-get update
sudo apt-get install -y libvips-dev libgsf-1-dev
14.04
sudo add-apt-repository -y ppa:lovell/trusty-backport-vips
sudo apt-get update
sudo apt-get install -y libvips-dev libgsf-1-dev
Mac OS
Install libvips via homebrew:
brew install homebrew/science/vips --with-webp --with-graphicsmagick
A missing or incorrectly configured Xcode Command Line Tools installation
can lead to a
library not found for -ljpeg
error.
If so, please try: xcode-select --install
.
The gettext dependency of libvips
can lead
to a library not found for -lintl
error.
If so, please try brew link gettext --force
.
Windows
Requires x86 32-bit Node.js or io.js (use iojs.exe
rather than node.exe
).
The WebP format is currently unsupported.
- Ensure the node-gyp prerequisites are met.
- Download and unzip
vips-dev.x.y.z.zip
. - Set the
VIPS_HOME
environment variable to the full path of thevips-dev-x.y.z
directory. - Add
vips-dev-x.y.z\bin
toPATH
.
Versions of MSVC more recent than 2013 may require the use of npm install --arch=ia32 --msvs_version=2013
.
Heroku
Alessandro Tagliapietra maintains an Heroku buildpack for libvips and its dependencies.
Docker
Marc Bachmann maintains a Dockerfile for libvips.
docker pull marcbachmann/libvips