I have installed node and npm latest version in ubuntu 20.04 and debian buster.
I already installed libvips and glib packages packages from the apt in linux
/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
#include <glib-object.h>
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [sharp.target.mk:129: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/cordova-res/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.4.0-42-lowlatency
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/cordova-res/node_modules/sharp
gyp ERR! node -v v10.21.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.25.4 install: `(node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.25.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-25T14_48_56_334Z-debug.log
If anyone know please answer. How can i add glib-object.h to the vips directory?
3
Answers
Now It's fixed by changing required version (supported old nodejs version). Using nvm you can switch between versions easily without uninstalling current version. Many packages in node, does not support up-to-date (latest) versions. So you have to migrate to older one instead. even it failes install prebuild via package manager(npm).
brew install pkg-config
Now you need to install libvips from source
Download and extract the latest version from https://github.com/libvips/libvips/releases
cd to the extracted folder
./configure
make
sudo make install
npm i -g cordova-res
please note if this is about ionic installation capacitor-assets replaced cordova-res .
https://github.com/ionic-team/capacitor-assets