Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Install Sharp #2900

Closed
conoralvarez opened this issue Sep 21, 2021 · 4 comments
Closed

Can't Install Sharp #2900

conoralvarez opened this issue Sep 21, 2021 · 4 comments

Comments

@conoralvarez
Copy link

Command:

panda@debian:~$ uname -a
Linux debian 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux

panda@debian:~$ node -v
v16.9.1

panda@debian:~$ npm -v
7.24.0

panda@debian:~$ npm install -g node-gyp

panda@debian:~$ sudo apt-get install -y libvips-dev

panda@debian:~$ npm cache verify

panda@debian:~$ npm ls
/home/panda
└── (empty)

panda@debian:~$ npm ls -g
/usr/local/node/lib
├── corepack@0.9.0
├── node-gyp@8.2.0
├── npm@7.24.0
└── yarn@1.22.11


panda@debian:~$ npm install -g --verbose sharp

Did you see the documentation relating to installation?
Yes

Have you ensured the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime?
Yes

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?
Yes

If you are using npm v6 or earlier and installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?
Yes

If you are using npm v7, does the user running npm install own the directory it is run in?
Yes

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?
No

What is the complete output of running npm install --verbose sharp? Have you checked this output for useful error messages?

...
396 timing build:link:node_modules/sharp/node_modules/semver Completed in 6ms
397 timing build:link Completed in 7ms
398 info run sharp@0.29.1 install node_modules/sharp node-gyp rebuild
399 info run sharp@0.29.1 install { code: 1, signal: null }
400 timing reify:rollback:createSparse Completed in 127ms
401 timing reify:rollback:retireShallow Completed in 0ms
402 timing command:install Completed in 4547ms
403 verbose stack Error: command failed
403 verbose stack     at ChildProcess.<anonymous> (/usr/local/node/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
403 verbose stack     at ChildProcess.emit (node:events:394:28)
403 verbose stack     at maybeClose (node:internal/child_process:1064:16)
403 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
404 verbose pkgid sharp@0.29.1
405 verbose cwd /home/panda
406 verbose Linux 5.10.0-8-amd64
407 verbose argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install" "-g" "--verbose" "sharp"
408 verbose node v16.9.1
409 verbose npm  v7.24.0
410 error code 1
411 error path /usr/local/node/lib/node_modules/sharp
412 error command failed
413 error command sh -c node-gyp rebuild
414 error make: Entering directory '/usr/local/node/lib/node_modules/sharp/build'
414 error   touch Release/obj.target/libvips-cpp.stamp
414 error   cc -o Release/obj.target/nothing/node_modules/node-addon-api/nothing.o ../node_modules/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/home/panda/.cache/node-gyp/16.9.1/include/node -I/home/panda/.cache/node-gyp/16.9.1/src -I/home/panda/.cache/node-gyp/16.9.1/deps/openssl/config -I/home/panda/.cache/node-gyp/16.9.1/deps/openssl/openssl/include -I/home/panda/.cache/node-gyp/16.9.1/deps/uv/include -I/home/panda/.cache/node-gyp/16.9.1/deps/zlib -I/home/panda/.cache/node-gyp/16.9.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_modules/node-addon-api/nothing.o.d.raw   -c
414 error   rm -f Release/obj.target/node_modules/node-addon-api/nothing.a && ar crs Release/obj.target/node_modules/node-addon-api/nothing.a Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
414 error   ln -f "Release/obj.target/node_modules/node-addon-api/nothing.a" "Release/nothing.a" 2>/dev/null || (rm -rf "Release/nothing.a" && cp -af "Release/obj.target/node_modules/node-addon-api/nothing.a" "Release/nothing.a")
414 error   g++ -o Release/obj.target/sharp-linux-x64/src/common.o ../src/common.cc '-DNODE_GYP_MODULE_NAME=sharp-linux-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=5' '-DBUILDING_NODE_EXTENSION' -I/home/panda/.cache/node-gyp/16.9.1/include/node -I/home/panda/.cache/node-gyp/16.9.1/src -I/home/panda/.cache/node-gyp/16.9.1/deps/openssl/config -I/home/panda/.cache/node-gyp/16.9.1/deps/openssl/openssl/include -I/home/panda/.cache/node-gyp/16.9.1/deps/uv/include -I/home/panda/.cache/node-gyp/16.9.1/deps/zlib -I/home/panda/.cache/node-gyp/16.9.1/deps/v8/include -I../node_modules/node-addon-api -I../vendor/8.11.3/linux-x64/include -I../vendor/8.11.3/linux-x64/include/glib-2.0 -I../vendor/8.11.3/linux-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++14 -std=c++0x -fexceptions -Wall -Os -Wno-cast-function-type -MMD -MF ./Release/.deps/Release/obj.target/sharp-linux-x64/src/common.o.d.raw   -c
414 error make: Leaving directory '/usr/local/node/lib/node_modules/sharp/build'
415 error gyp info it worked if it ends with ok
415 error gyp verb cli [
415 error gyp verb cli   '/usr/local/node/bin/node',
415 error gyp verb cli   '/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
415 error gyp verb cli   'rebuild'
415 error gyp verb cli ]
415 error gyp info using node-gyp@7.1.2
415 error gyp info using node@16.9.1 | linux | x64
415 error gyp verb command rebuild []
415 error gyp verb command clean []
415 error gyp verb clean removing "build" directory
415 error gyp verb command configure []
415 error gyp verb find Python Python is not set from command line or npm configuration
415 error gyp verb find Python Python is not set from environment variable PYTHON
415 error gyp verb find Python checking if "python3" can be used
415 error gyp verb find Python - executing "python3" to get executable path
415 error gyp verb find Python - executable path is "/usr/bin/python3"
415 error gyp verb find Python - executing "/usr/bin/python3" to get version
415 error gyp verb find Python - version is "3.9.2"
415 error gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
415 error gyp verb get node dir no --target version specified, falling back to host node version: 16.9.1
415 error gyp verb command install [ '16.9.1' ]
415 error gyp verb install input version string "16.9.1"
415 error gyp verb install installing version: 16.9.1
415 error gyp verb install --ensure was passed, so won't reinstall if already installed
415 error gyp verb install version is already installed, need to check "installVersion"
415 error gyp verb got "installVersion" 9
415 error gyp verb needs "installVersion" 9
415 error gyp verb install version is good
415 error gyp verb get node dir target node version installed: 16.9.1
415 error gyp verb build dir attempting to create "build" dir: /usr/local/node/lib/node_modules/sharp/build
415 error gyp verb build dir "build" dir needed to be created? /usr/local/node/lib/node_modules/sharp/build
415 error gyp verb build/config.gypi creating config file
415 error gyp verb build/config.gypi writing out config file: /usr/local/node/lib/node_modules/sharp/build/config.gypi
415 error (node:5075) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
415 error (Use `node --trace-deprecation ...` to show where the warning was created)
415 error gyp verb config.gypi checking for gypi file: /usr/local/node/lib/node_modules/sharp/config.gypi
415 error gyp verb common.gypi checking for gypi file: /usr/local/node/lib/node_modules/sharp/common.gypi
415 error gyp verb gyp gyp format was not specified; forcing "make"
415 error gyp info spawn /usr/bin/python3
415 error gyp info spawn args [
415 error gyp info spawn args   '/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
415 error gyp info spawn args   'binding.gyp',
415 error gyp info spawn args   '-f',
415 error gyp info spawn args   'make',
415 error gyp info spawn args   '-I',
415 error gyp info spawn args   '/usr/local/node/lib/node_modules/sharp/build/config.gypi',
415 error gyp info spawn args   '-I',
415 error gyp info spawn args   '/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
415 error gyp info spawn args   '-I',
415 error gyp info spawn args   '/home/panda/.cache/node-gyp/16.9.1/include/node/common.gypi',
415 error gyp info spawn args   '-Dlibrary=shared_library',
415 error gyp info spawn args   '-Dvisibility=default',
415 error gyp info spawn args   '-Dnode_root_dir=/home/panda/.cache/node-gyp/16.9.1',
415 error gyp info spawn args   '-Dnode_gyp_dir=/usr/local/node/lib/node_modules/npm/node_modules/node-gyp',
415 error gyp info spawn args   '-Dnode_lib_file=/home/panda/.cache/node-gyp/16.9.1/<(target_arch)/node.lib',
415 error gyp info spawn args   '-Dmodule_root_dir=/usr/local/node/lib/node_modules/sharp',
415 error gyp info spawn args   '-Dnode_engine=v8',
415 error gyp info spawn args   '--depth=.',
415 error gyp info spawn args   '--no-parallel',
415 error gyp info spawn args   '--generator-output',
415 error gyp info spawn args   'build',
415 error gyp info spawn args   '-Goutput_dir=.'
415 error gyp info spawn args ]
415 error gyp verb command build []
415 error gyp verb build type Release
415 error gyp verb architecture x64
415 error gyp verb node dev dir /home/panda/.cache/node-gyp/16.9.1
415 error gyp verb `which` succeeded for `make` /usr/bin/make
415 error gyp info spawn make
415 error gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
415 error In file included from ../src/common.cc:24:
415 error /usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
415 error    35 | #include <glib-object.h>
415 error       |          ^~~~~~~~~~~~~~~
415 error compilation terminated.
415 error make: *** [sharp-linux-x64.target.mk:139: Release/obj.target/sharp-linux-x64/src/common.o] Error 1
415 error gyp ERR! build error
415 error gyp ERR! stack Error: `make` failed with exit code: 2
415 error gyp ERR! stack     at ChildProcess.onExit (/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
415 error gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
415 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
415 error gyp ERR! System Linux 5.10.0-8-amd64
415 error gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
415 error gyp ERR! cwd /usr/local/node/lib/node_modules/sharp
415 error gyp ERR! node -v v16.9.1
415 error gyp ERR! node-gyp -v v7.1.2
415 error gyp ERR! not ok
416 verbose exit 1

What is the output of running npx envinfo --binaries --system?

panda@debian:~$ npx envinfo --binaries --system
Need to install the following packages:
  envinfo
Ok to proceed? (y) y

  System:
    OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (2) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 1.93 GB / 16 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 16.9.1 - /usr/local/node/bin/node
    Yarn: 1.22.11 - /usr/local/node/bin/yarn
    npm: 7.24.0 - /usr/local/node/bin/npm
@lovell
Copy link
Owner

lovell commented Sep 21, 2021

Hi, you shouldn't need to install the libvips-dev package - please can you try removing it.

I also highly recommend people do not install packages globally via the npm install -g flag. When using npm v7 in particular this can lead to permissions problems, hence this very important question that you may want to recheck:

If you are using npm v7, does the user running npm install own the directory it is run in?

In addition, sharp should tell you about decisions it's making at install time, but it looks like there's missing information from this installation log, This is a problem I've seen in another issue within the last week so I think there may be a new bug/feature in recent versions of npm v7 that is hiding log output and making debugging these kind of problems more difficult.

If you're able to try npm v6 to remove the possible cause of npm v7 features/bugs, that would be very helpful.

@conoralvarez
Copy link
Author

conoralvarez commented Sep 21, 2021

Successfully installed Sharp, if i use nodejs 14.x and npm 6.x.

panda@debian:~$ node -v
v14.17.6

panda@debian:~$ npm -v
6.14.15

panda@debian:~$ npm install -g node-gyp

panda@debian:~$ npm view sharp

sharp@0.29.1 | Apache-2.0 | deps: 8 | versions: 111
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images
https://github.com/lovell/sharp

keywords: jpeg, png, webp, avif, tiff, gif, svg, jp2, dzi, image, resize, thumbnail, crop, embed, libvips, vips

dist
.tarball: https://registry.npmjs.org/sharp/-/sharp-0.29.1.tgz
.shasum: f60b50f24f399464a24187c86bd2da41aae50b85
.integrity: sha512-DpgdAny9TuS+oWCQ7MRS8XyY9x6q1+yW3a5wNx0J3HrGuB/Jot/8WcT+lElHY9iJu2pwtegSGxqMaqFiMhs4rQ==
.unpackedSize: 464.3 kB

dependencies:
color: ^4.0.1            prebuild-install: ^6.1.4 tar-fs: ^2.1.1           
detect-libc: ^1.0.3      semver: ^7.3.5           tunnel-agent: ^0.6.0     
node-addon-api: ^4.1.0   simple-get: ^3.1.0       

maintainers:
- lovell <npm@lovell.info>

dist-tags:
latest: 0.29.1  

published 2 weeks ago by lovell <npm@lovell.info>

@conoralvarez
Copy link
Author

@lovell

Thank you!

@lovell
Copy link
Owner

lovell commented Sep 21, 2021

The npm v7 bug is npm/cli#2606

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants