I was having problems installing dependencies to a not too old frontend project using yarn. The installation failed with a long traceback which included the following:
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o LIBTOOL-STATIC Release/nothing.awarning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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.stamp CXX(target) Release/obj.target/sharp/src/common.o../src/common.cc:23: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: 2gyp ERR! stack at ChildProcess.onExit (/Users/uninen/.nvm/versions/node/v14.18.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
The problem was related to sharp
-package and node-gyp
-package, both which were some deeper dependencies in the project. I found a couple of seemingly related GitHub issues from both of these projects but the solution that fixed the problem was easy: I installed the missing vips
-package with brew:
brew install vips
These kind of issues are the main reason I try to keep all frontend projects as small as possible and make extra effort to not include anything that requires build tools if you absolutely don’t need to.