Closed KarelJanVanHaute closed 2 years ago
Hi, it looks like you're attempting to compile sharp from source against a globally-installed libvips:
sharp: Detected globally-installed libvips v8.12.2 sharp: Building from source via node-gyp
The salient part of this error log is:
Package xproto was not found in the pkg-config search path
This suggests there's probably something wrong with your homebrew installation of pkg-config
itself, unrelated to sharp or libvips.
Please try running brew update && brew upgrade
to fix any homebrew-related problems.
I did a brew update && brew upgrade
and I reinstalled pkg-config and the vips. But to no avail. Still getting the same error.
Thanks, this still looks like a Homebrew dependency problem - perhaps run brew install xorgproto
if its missing.
Alternatively, if you don't need to use the brew-installed libvips, run brew remove vips
then re-install sharp and it will use its own prebuilt binaries.
When I remove the vips in brew. I get the following error.
error /Volumes/External/GIT/BASWEB/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: /Volumes/External/GIT/BASWEB/node_modules/sharp
Output:
sharp: Using cached /Users/kareljanvanhaute/.npm/_libvips/libvips-8.10.6-darwin-arm64v8.tar.br
prebuild-install WARN install No prebuilt binaries found (target=3 runtime=napi arch=arm64 libc= platform=darwin)
gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@16.15.0 | darwin | arm64
gyp info find Python using Python version 3.9.12 found at "/usr/local/opt/python@3.9/bin/python3.9"
gyp info spawn /usr/local/opt/python@3.9/bin/python3.9
gyp info spawn args [
gyp info spawn args '/Users/kareljanvanhaute/.nvm/versions/node/v16.15.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 '/Volumes/External/GIT/BASWEB/node_modules/sharp/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/kareljanvanhaute/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/kareljanvanhaute/Library/Caches/node-gyp/16.15.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=/Users/kareljanvanhaute/Library/Caches/node-gyp/16.15.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/kareljanvanhaute/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/kareljanvanhaute/Library/Caches/node-gyp/16.15.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Volumes/External/GIT/BASWEB/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 args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
LIBTOOL-STATIC Release/nothing.a
Usage: /Applications/MAMP/Library/bin/libtool [OPTION]... [MODE-ARG]...
Try 'libtool --help' for more information.
libtool: error: unrecognised option: '-static'
make: *** [Release/nothing.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/kareljanvanhaute/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:527:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.4.0
gyp ERR! command "/Users/kareljanvanhaute/.nvm/versions/node/v16.15.0/bin/node" "/Users/kareljanvanhaute/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Volumes/External/GIT/BASWEB/node_modules/sharp
And here the full output from where the errors start
https://sharp.pixelplumbing.com/install#apple-m1 says
Prebuilt sharp and libvips binaries have been provided for macOS on ARM64 since sharp v0.29.0.
The log you've provided looks like it's an attempt to install sharp v0.28.x - please upgrade.
@lovell thank you very much for your time. I used sharp in another plugin which used indeed 0.28.0. I now forced it to use the latest version. Now it works again.
For future reference, my steps:
The code I changed in the yarn.lock file:
favicons@^6.2.2:
version "6.2.2"
resolved "https://registry.npmjs.org/favicons/-/favicons-6.2.2.tgz"
integrity sha512-qhvFqbhlXA/JYIDYuxTrE4uT9rcpTCrWvF3UG0GxBoLl/XgFBBTrZkQvASrkMebSwDCJ9kKGypRWIbvoRZLBsw==
dependencies:
clone "^2.1.2"
colors "^1.4.0"
image-size "^0.8.3"
jimp "^0.16.1"
jsontoxml "^1.0.1"
lodash.defaultsdeep "^4.6.1"
require-directory "^2.1.1"
sharp "^0.30.4"
through2 "^4.0.2"
tinycolor2 "^1.4.2"
to-ico "^1.1.5"
vinyl "^2.2.1"
xml2js "^0.4.23"
It's a bit weird it crashes because it had sharp "^0.28.0" so shouldn't it use 0.30.4 in that case on install?
Specifying a semver range of ^0.28.0
will use 0.28.3
as that's the most recent version on the 0.28.x
line.
Alternatively, if you don't need to use the brew-installed libvips, run
brew remove vips
then re-install sharp and it will use its own prebuilt binaries.
Removing vips
worked! Wow!
Alternatively, if you don't need to use the brew-installed libvips, run
brew remove vips
then re-install sharp and it will use its own prebuilt binaries.Removing
vips
worked! Wow!
Worked for me too! Thanks
Possible install-time or require-time problem
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
.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.Is this a problem with filesystem permissions?
If you are using npm v6 or earlier and installing as a
root
orsudo
user, have you tried with thenpm install --unsafe-perm
flag?If you are using npm v7 or later, does the user running
npm install
own the directory it is run in?If you are using the
ignore-scripts
feature ofnpm
, have you tried with thenpm install --ignore-scripts=false
flag?What is the complete output of running
npm install --verbose --foreground-scripts sharp
in an empty directory?What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?System: OS: macOS 12.3.1 CPU: (8) arm64 Apple M1 Memory: 178.61 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm