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 [email protected]
gyp info using [email protected] | 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:makefailed 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
.> [email protected] 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:makefailed 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! [email protected] 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 [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
What can i do?
I understood. Terrible that I have to do downgrade node 11 to 10. :(
"Pre-compiled binaries for sharp are provided for use with Node versions 6, 8 and 10 on 64-bit Windows, OS X and Linux platforms."
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.
@lovell Thanks for the solution. We all love open source.
I downgraded the Node version from 12 to 10 then could install sharp.
Is there any solution for node v12.x yet? I had no issue with installing until today on my mac, and I used it extensively for lobg time. I still can install it without cleaning the cache and node_modules and yarn.lock, but if I remove yarn.lock and try to install from clean sheets, it fails with error:
[4/4] 🔨 Building fresh packages...
[6/16] ⡀ sharp
[-/16] ⡀ waiting...
[-/16] ⡀ waiting...
[-/16] ⢀ waiting...
error /Users/justfly/projects/poolotto-gatsby/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: /Users/justfly/projects/poolotto-gatsby/node_modules/sharp
Output:
info sharp Using cached /Users/justfly/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz
prebuild-install WARN install dlopen(/Users/justfly/projects/poolotto-gatsby/node_modules/sharp/build/Release/sharp.node, 1): Library not loaded: @rpath/libvips-cpp.42.dylib
prebuild-install WARN install Referenced from: /Users/justfly/projects/poolotto-gatsby/node_modules/sharp/build/Release/sharp.node
prebuild-install WARN install Reason: image not found
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 2.7.15 found at "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp info spawn /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/Users/justfly/.nvm/versions/node/v12.9.0/lib/node_modules/npm/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 '/Users/justfly/projects/poolotto-gatsby/node_modules/sharp/build/config.gypi',
Most helpful comment
Hello, if you weren't aware the
nandependency 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.