1
votes

I tried everything.

  1. Removed node_modules and yarn.lock
  2. Downgraded sharp-plugins
  3. apt installed libvips && libvips-dev
  4. $ npm install -g node-gyp

Before installing libvips-dev. The build error was caused because libvips wasn't found. Now after apt-get installing libvips-dev, glib-object is not found. I don't know what to do.

Here is the useful bit of the error message:

make: Entering directory '/home/me/Desktop/project/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:25:
/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
 #include <glib-object.h>

Any help?

2

2 Answers

2
votes

Apparently, there was a "bad" version of sharp cached by npm.

https://github.com/gatsbyjs/gatsby/issues/8852#issuecomment-427641767

This fixed it:

rm  /home/me/.npm/_libvips/libvips-8*
0
votes

I have the same problem, and other rm doesn't work for me.

May be because I use nvm. I remove the node under nvm, (~/.nvm/versions/node/v14.16.1/) and reinstall node version, and package node-gyp, node-pre-gyp.

It works.