question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installing Sharp module provides an error

See original GitHub issue

I have…

$ node -v
v11.4.0
$ node-gyp -v
v3.8.0
$ yarn -v
1.12.3
$npm -v
6.4.1

I’m trying to install with yarn and/or npm: $ yarn add sharp

yarn add v1.12.3 info No lockfile found. [1/4] Resolving packages… [2/4] Fetching packages… [3/4] Linking dependencies… [4/4] Building fresh packages… error /projects/test/node_modules/sharp: Command failed. Exit code: 1 Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) Arguments: Directory: /projects/test/node_modules/sharp Output: info sharp Using cached /home/yesworld/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz prebuild-install WARN install No prebuilt binaries found (target=11.4.0 runtime=node arch=x64 platform=linux) gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@11.4.0 | linux | x64 gyp info spawn /usr/bin/python2 gyp info spawn args [ ‘/home/yesworld/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py’, gyp info spawn args ‘binding.gyp’, gyp info spawn args ‘-f’, gyp info spawn args ‘make’, gyp info spawn args ‘-I’, gyp info spawn args ‘/projects/test/node_modules/sharp/build/config.gypi’, gyp info spawn args ‘-I’, gyp info spawn args ‘/home/yesworld/.config/yarn/global/node_modules/node-gyp/addon.gypi’, gyp info spawn args ‘-I’, gyp info spawn args ‘/home/yesworld/.node-gyp/11.4.0/include/node/common.gypi’, gyp info spawn args ‘-Dlibrary=shared_library’, gyp info spawn args ‘-Dvisibility=default’, gyp info spawn args ‘-Dnode_root_dir=/home/yesworld/.node-gyp/11.4.0’, gyp info spawn args ‘-Dnode_gyp_dir=/home/yesworld/.config/yarn/global/node_modules/node-gyp’, gyp info spawn args ‘-Dnode_lib_file=/home/yesworld/.node-gyp/11.4.0/<(target_arch)/node.lib’, gyp info spawn args ‘-Dmodule_root_dir=/projects/test/node_modules/sharp’, gyp info spawn args ‘-Dnode_engine=v8’, gyp info spawn args ‘–depth=.’, gyp info spawn args ‘–no-parallel’, gyp info spawn args ‘–generator-output’, gyp info spawn args ‘build’, gyp info spawn args ‘-Goutput_dir=.’ ] gyp info spawn make gyp info spawn args [ ‘BUILDTYPE=Release’, ‘-C’, ‘build’ ] make: Entering directory ‘/projects/test/node_modules/sharp/build’ TOUCH Release/obj.target/libvips-cpp.stamp CXX(target) Release/obj.target/sharp/src/common.o make: g++: Command not found make: *** [Release/obj.target/sharp/src/common.o] Error 127 sharp.target.mk:128: recipe for target ‘Release/obj.target/sharp/src/common.o’ failed make: Leaving directory ‘/projects/test/node_modules/sharp/build’ gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/yesworld/.config/yarn/global/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12) gyp ERR! System Linux 4.15.0-42-generic gyp ERR! command “/usr/bin/node” “/home/yesworld/.yarn/bin/node-gyp” “rebuild” gyp ERR! cwd /projects/test/node_modules/sharp gyp ERR! node -v v11.4.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

OR

$ npm install sharp

.> sharp@0.21.1 install /projects/test/node_modules/sharp .> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /home/yesworld/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz prebuild-install WARN install No prebuilt binaries found (target=11.4.0 runtime=node arch=x64 platform=linux) make: Entering directory ‘/projects/test/node_modules/sharp/build’ TOUCH Release/obj.target/libvips-cpp.stamp CXX(target) Release/obj.target/sharp/src/common.o make: g++: Command not found sharp.target.mk:128: recipe for target ‘Release/obj.target/sharp/src/common.o’ failed make: *** [Release/obj.target/sharp/src/common.o] Error 127 make: Leaving directory ‘/projects/test/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:262:23) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12) gyp ERR! System Linux 4.15.0-42-generic gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild” gyp ERR! cwd /projects/test/node_modules/sharp gyp ERR! node -v v11.4.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open ‘/projects/test/package.json’ npm WARN test No description npm WARN test No repository field. npm WARN test No README data npm WARN test No license field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sharp@0.21.1 install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sharp@0.21.1 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

What can i do?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
lovellcommented, Dec 18, 2018

Hello, if you weren’t aware the nan dependency added support for Node 11 a couple of days ago in https://github.com/nodejs/nan/pull/830 so the next version of sharp can now support this also.

Please do not describe the work of open source maintainers as “terrible” when requesting unpaid help from them in the future.

4reactions
ops-gauravcommented, Jan 24, 2019

@lovell Thanks for the solution. We all love open source.

Read more comments on GitHub >

github_iconTop Results From Across the Web

10 Answers - 10 - Stack Overflow
This fixed Error: Something went wrong installing the "sharp" module Cannot find module '../build/Release/sharp-darwin-arm64v8.node' for me on ...
Read more >
Something went wrong installing the "sharp" module #24559
Had node 8 installed when I first noticed the error. Upgraded to 12, cleared npm cache npm cache clear and gatsby cache gatsby...
Read more >
Something went wrong installing the "sharp" module (fix)
I was using Node version v14.14.0 when I got the sharp module error and downgraded to several earlier versions without luck. Then I...
Read more >
Cannot find module 'sharp' error in Node.js [Solved] | bobbyhadz
The error "Cannot find name 'sharp'" occurs when we import the sharp module before installing it. To solve the error, install the sharp...
Read more >
sharp - npm
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images. Latest version: 0.31.3, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found