Gatsby Build Error

Gatsby Build Error When Building Sharp on Apple M1 with Homebrew

Marco Enrico
Mar 11, 2021

Gatsby will throw a build error related to the sharp library when you try to launch the development server. This happens on my homebrew installed node.

gyp info spawn makegyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]CC(target) Release/obj.target/nothing/../node-addon-api/nothing.oLIBTOOL-STATIC Release/nothing.awarning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)TOUCH Release/obj.target/libvips-cpp.stampCXX(target) Release/obj.target/sharp/src/common.o../src/common.cc:24: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 errorgyp ERR! stack Error: `make` failed with exit code: 2

To fix this all you need to do is to install libvibs via homebrew:

brew install libvips

That’s it!

--

--