lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
28.97k stars 1.29k forks source link

Issue installing sharp glib-object.h: No such file or directory #4003

Closed irigo3 closed 6 months ago

irigo3 commented 7 months ago

Possible install-time or require-time problem

You must confirm both of these before continuing.

Are you using the latest version of sharp?

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

Are you using a supported runtime?

If you cannot confirm any of these, please upgrade to the latest version and try again before opening an issue.

Are you using a supported package manager and installing optional dependencies?

If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.

What is the complete error message, including the full stack trace?

npm ERR! gyp ERR! cwd /builds/strapi/node_modules/@strapi/plugin-upload/node_modules/sharp npm ERR! gyp ERR! node -v v18.19.1 npm ERR! gyp ERR! node-gyp -v v9.3.1 npm ERR! gyp ERR! not ok npm verb exit 1 npm verb unfinished npm timer reify 1708527222217 npm verb unfinished npm timer reify:build 1708527313827 npm verb unfinished npm timer build 1708527313828 npm verb unfinished npm timer build:deps 1708527313829 npm verb unfinished npm timer build:run:install 1708527313928 npm verb unfinished npm timer build:run:install:node_modules/@strapi/plugin-upload/node_modules/sharp 1708527313956 npm verb code 1

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-02-21T14_53_41_942Z-debug-0.log

section_end:1708527324:step_script section_start:1708527324:cleanup_file_variables Cleaning up project directory and file based variables

section_end:1708527324:cleanup_file_variables ERROR: Job failed: command terminated with exit code 1 

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

npm install --verbose --foreground-scripts sharp npm verb cli /usr/bin/node /usr/bin/npm npm info using npm@9.6.6 npm info using node@v18.19.1 npm verb title npm install sharp npm verb argv "install" "--loglevel" "verbose" "--foreground-scripts" "sharp" npm verb logfile logs-max:10 dir:/root/.npm/_logs/2024-02-21T15_47_33_098Z- npm verb logfile /root/.npm/_logs/2024-02-21T15_47_33_098Z-debug-0.log gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory '/builds/strapi/node_modules/@strapi/plugin-upload/node_modules/sharp/build' cc -o Release/obj.target/nothing/../../../../node-addon-api/nothing.o ../../../../../node-addon-api/nothing.c '-DNODE_GYP_MODULE_NAME=nothing' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' -I/root/.cache/node-gyp/18.19.1/include/node -I/root/.cache/node-gyp/18.19.1/src -I/root/.cache/node-gyp/18.19.1/deps/openssl/config -I/root/.cache/node-gyp/18.19.1/deps/openssl/openssl/include -I/root/.cache/node-gyp/18.19.1/deps/uv/include -I/root/.cache/node-gyp/18.19.1/deps/zlib -I/root/.cache/node-gyp/18.19.1/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/nothing/../../../../node-addon-api/nothing.o.d.raw -c rm -f Release/obj.target/../../../../node-addon-api/nothing.a Release/obj.target/../../../../node-addon-api/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../../../../node-addon-api/nothing.a` ar crs Release/obj.target/../../../../node-addon-api/nothing.a @Release/obj.target/../../../../node-addon-api/nothing.a.ar-file-list ln -f "Release/obj.target/../../../../node-addon-api/nothing.a" "Release/nothing.a" 2>/dev/null || (rm -rf "Release/nothing.a" && cp -af "Release/obj.target/../../../../node-addon-api/nothing.a" "Release/nothing.a") touch Release/obj.target/libvips-cpp.stamp g++ -o Release/obj.target/sharp-linuxmusl-x64/src/common.o ../src/common.cc '-DNODE_GYP_MODULE_NAME=sharp-linuxmusl-x64' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_VERSION=7' '-DNODE_ADDON_API_DISABLE_DEPRECATED' '-DNODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/18.19.1/include/node -I/root/.cache/node-gyp/18.19.1/src -I/root/.cache/node-gyp/18.19.1/deps/openssl/config -I/root/.cache/node-gyp/18.19.1/deps/openssl/openssl/include -I/root/.cache/node-gyp/18.19.1/deps/uv/include -I/root/.cache/node-gyp/18.19.1/deps/zlib -I/root/.cache/node-gyp/18.19.1/deps/v8/include -I../../../../../node-addon-api -I../vendor/8.14.5/linuxmusl-x64/include -I../vendor/8.14.5/linuxmusl-x64/include/glib-2.0 -I../vendor/8.14.5/linuxmusl-x64/lib/glib-2.0/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -std=c++0x -fexceptions -Wall -Os -Wno-cast-function-type -MMD -MF ./Release/.deps/Release/obj.target/sharp-linuxmusl-x64/src/common.o.d.raw -c In file included from ../src/common.cc:13: /usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory 35 | #include | ^~~~~~~~~~~~~~~ compilation terminated. make: *** [sharp-linuxmusl-x64.target.mk:143: Release/obj.target/sharp-linuxmusl-x64/src/common.o] Error 1 make: Leaving directory '/builds/strapi/node_modules/@strapi/plugin-upload/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/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23) gyp ERR! stack at ChildProcess.emit (node:events:517:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12) gyp ERR! System Linux 5.15.139 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /builds/strapi/node_modules/@strapi/plugin-upload/node_modules/sharp gyp ERR! node -v v18.19.1 gyp ERR! node-gyp -v v9.3.1 gyp ERR! not ok npm info run sharp@0.32.6 install { code: 1, signal: null } npm verb stack Error: command failed npm verb stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) npm verb stack at ChildProcess.emit (node:events:517:28) npm verb stack at maybeClose (node:internal/child_process:1098:16) npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:303:5) npm verb pkgid sharp@0.32.6 npm verb code 1 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-02-21T15_47_33_098Z-debug-0.log

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

npm WARN exec The following package was not found and will be installed: envinfo@7.11.1 System: OS: Linux 5.15 Alpine Linux CPU: (8) x64 Intel(R) Xeon(R) Platinum 8488C Memory: 25.15 GB / 30.80 GB Container: Yes Shell: 1.36.1 - /bin/ash Binaries: Node: 18.19.1 - /usr/bin/node npm: 9.6.6 - /usr/bin/npm

lovell commented 7 months ago

npm info run sharp@0.32.6 install node_modules/@strapi/plugin-upload/node_modules/sharp

It looks like you're trying to install @strapi/plugin-upload, which depends on an out-of-date version of sharp.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

https://github.com/strapi/strapi/pull/19311

lovell commented 6 months ago

Closing as this is a downstream problem - please subscribe to https://github.com/strapi/strapi/pull/19311 for updates.