Closed ricovitch closed 2 years ago
Hi, as I mentioned in https://github.com/lovell/sharp/issues/3154, sharp_local_prebuilds
is used to provide the location for prebuilt sharp binaries rather than libvips binaries.
To install the prebuilt sharp binaries from a directory on the local filesystem, set the
sharp_local_prebuilds
npm config option or thenpm_config_sharp_local_prebuilds
environment variable.
You mentioned in https://github.com/lovell/sharp/issues/3154#issuecomment-1080801547 that you had installed libvips via homebrew, but the installation log above does not reflect this. Did you use brew install vips
?
Hi, sorry I tried to restart everything from scratch today following closely the instructions.
Yesterday I tried installing libvips via homebrew, you're right, and here is the result of brew install vips
command :
Warning: vips 8.12.1 is already installed and up-to-date.
To reinstall 8.12.1, run:
brew reinstall vips
Also since I created this ticket I've made some progress and instead of using a local binary I think I achieved to get the binaries through our internal Artifactory instance with this .npmrc
configuration
SHARP_BINARY_HOST=https://artifactory.2b82.aws.cloud.airbus.corp/ui/native/github-releases/lovell/sharp/releases/download
SHARP_LIBVIPS_BINARY_HOST=https://artifactory.2b82.aws.cloud.airbus.corp/ui/native/github-releases/lovell/sharp-libvips/releases/download
Now I had an issue with node-gyp and xcode command line tools, that I think I resolved using the instructions here : https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md#Solutions
Finally here is the new npm install --verbose sharp
after all these steps
Warning: vips 8.12.1 is already installed and up-to-date.
sharp v0.30.x requires libvips v8.12.2, please brew update && brew upgrade
https://github.com/Homebrew/homebrew-core/blob/master/Formula/vips.rb#L4
Oh yes that makes sense. I'll try to update and keep you informed. Thank you for your support.
It seems like I'm unable to get the 8.12.2 through brew.
Here is the output of brew info vips
after running brew uninstall vips
vips: stable 8.12.1 (bottled)
Image processing library
https://github.com/libvips/libvips
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/vips.rb
I assume it should display vips: stable 8.12.2 ?
Did you run brew update && brew upgrade
? Perhaps your homebrew is also locked to this corporate proxy?
You were right ! Brew was locked by the proxy. brew update
command was failing without configuring HTTP_PROXY and HTTPS_PROXY env vars.
So I've been able to install libvips 8.12.2 globally with brew.
Now running brew info vips
output this
vips: stable 8.12.2 (bottled)
Image processing library
https://github.com/libvips/libvips
/usr/local/Cellar/vips/8.12.2_1 (165 files, 13.6MB) *
Poured from bottle on 2022-03-29 at 14:29:19
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/vips.rb
Here is the new debug log from npm install --verbose sharp
npm timing command:install Completed in 12828ms
npm verb stack Error: command failed
npm verb stack at ChildProcess.<anonymous> (/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
npm verb stack at ChildProcess.emit (node:events:520:28)
npm verb stack at maybeClose (node:internal/child_process:1092:16)
npm verb stack at Socket.<anonymous> (node:internal/child_process:451:11)
npm verb stack at Socket.emit (node:events:520:28)
npm verb stack at Pipe.<anonymous> (node:net:687:12)
npm verb pkgid sharp@0.30.3
npm verb cwd /Users/helier_e/Dev/tests/gatsby/sharp-install
npm verb Darwin 19.6.0
npm verb argv "/Users/helier_e/.nvm/versions/node/v16.14.0/bin/node" "/Users/helier_e/.nvm/versions/node/v16.14.0/bin/npm" "install" "sharp" "--verbose"
npm verb node v16.14.0
npm verb npm v8.3.1
npm ERR! code 1
npm ERR! path /Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Detected globally-installed libvips v8.12.2
npm ERR! sharp: Building from source via node-gyp
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/Users/helier_e/.nvm/versions/node/v16.14.0/bin/node',
npm ERR! gyp verb cli '/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.14.0 | darwin | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - executable path is "/usr/local/opt/python@3.9/bin/python3.9"
npm ERR! gyp verb find Python - executing "/usr/local/opt/python@3.9/bin/python3.9" to get version
npm ERR! gyp verb find Python - version is "3.9.12"
npm ERR! gyp info find Python using Python version 3.9.12 found at "/usr/local/opt/python@3.9/bin/python3.9"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.14.0
npm ERR! gyp verb command install [ '16.14.0' ]
npm ERR! gyp verb install input version string "16.14.0"
npm ERR! gyp verb install installing version: 16.14.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.14.0
npm ERR! gyp verb build dir attempting to create "build" dir: /Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp/build
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp/build/config.gypi
npm ERR! gyp verb config.gypi checking for gypi file: /Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/local/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/helier_e/Library/Caches/node-gyp/16.14.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/helier_e/Library/Caches/node-gyp/16.14.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/helier_e/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package gobject-2.0 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `gobject-2.0.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! Package 'gobject-2.0', required by 'vips', not found
npm ERR! gyp: Call to 'PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.15:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/libdata/pkgconfig:/usr/libdata/pkgconfig" pkg-config --libs vips-cpp' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:259:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 19.6.0
npm ERR! gyp ERR! command "/Users/helier_e/.nvm/versions/node/v16.14.0/bin/node" "/Users/helier_e/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/helier_e/Dev/tests/gatsby/sharp-install/node_modules/sharp
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm verb exit 1
Looks like I also had issues with brew symlinks for some libs. Using the solution from the following comment I've been able to fix these issues : https://stackoverflow.com/a/26647594/3641075
Now finally npm install sharp
worked !
It was a difficult process but you've been very helpful. Thank you so much ❤️
Please can you now update your organisation's internal documentation relating to the use of this corporate proxy so your colleagues don't have to go through the same process.
I'll also leave https://opencollective.com/libvips here in case Airbus are looking for ways to invest some of the billions of profit it makes in helping to maintain the open source software upon which it depends.
I'll do my best to promote documentation and opensource backing culture at my level
Possible install-time or require-time problem
I'm trying to install sharp on MacOS behind a proxy by downloading sharp and libvips binaries locally and using npm
sharp_local_prebuilds
environment variable.I tried with the three following configuration in my
.npmrc
file with the same result :npm install
is the same as the architecture and platform of Node.js used at runtime.Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.Is this a problem with filesystem permissions?
If you are using npm v7 or later, does the user running
npm install
own the directory it is run in? YESWhat is the complete output of running
npm install --verbose sharp
?What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?