Skip to content

nodePackages.sharp

sharp (nodePackages.sharp) needs libvips (vips), and will try to download a prebuilt binary if it cannot detect a version newer than required with pkg-config1.

This can cause issues like:

npm error code 1
npm error path /build/source/node_modules/sharp
npm error command failed
npm error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-linux-x64.tar.br
npm error sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm error sharp: Installation error: getaddrinfo EAI_AGAIN github.com

To fix, add the following to the derivation:

{
  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ vips ];
}

  1. https://sharp.pixelplumbing.com/install/#custom-libvips