Handling Libvip/Sharp Errors in React Native Expo Installation

Zameer
2 min readMay 14, 2019

--

If you run into these errors,

info sharp Using cached /Users/<username>/.npm/_libvips/libvips-8.7.4-darwin-x64.tar.gzERR! sharp Please delete /Users/<username>/.npm/_libvips/libvips-8.7.4-darwin-x64.tar.gz as it is not a valid tarballERR! sharp zlib: unexpected end of fileinfo sharp Attempting to build from source via node-gyp but this may fail due to the above errorinfo sharp Please see https://sharp.pixelplumbing.com/page/install for required dependenciesTOUCH Release/obj.target/libvips-cpp.stampCXX(target) Release/obj.target/sharp/src/common.o../src/common.cc:25:10: fatal error: 'vips/vips8' file not found#include <vips/vips8>^~~~~~~~~~~~1 error generated.make: *** [Release/obj.target/sharp/src/common.o] Error 1gyp ERR! build error

followed by

npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! sharp@0.22.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the sharp@0.22.1 install script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

If you get these errors, I’ve spent hours trying out

  1. Running the sudo npm install -g expo-cli
  2. Tried out what’s here -https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globall

What worked was:

Deleted /Users/<username>/.npm/_libvips/libvips-8.7.4-darwin-x64.tar.gz

Next, For safety removed expo-cli — npm uninstall expo-cli

(mine was not global, it’s not a good practice to install cli tools per project)
Reinstalled the expo-cli.

It worked.

If you are a beginner react native/expo like me and f you are experiencing any other problem related to this, try to single out — Install sharp/any other npm packages separately and you can isolate the issues because dependencies causes many packages to fail sequentially we might lose track of which had failed in that mammoth log it spits out.

npm install -g node-gyp
npm install --save sharp

Best wishes on your expo journey!

--

--

Zameer
Zameer

Responses (1)