sharp error: Package OpenEXR was not found in the pkg-config search path
Asked Answered
D

2

7

I executed npm install on gatsby js directory on Mac.

  • macOs is Big Sur

  • Version is 11.4.

  • gatsby version is 3.11.0

  • gatsby-plugin-sharp version is 3.11.0

this error log is shown.

npm ERR! code 1
npm ERR! path /Users/<username>/<path>/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.11.2
npm ERR! sharp: Building from source via node-gyp
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.7.0 found at "/Users/<username>/.pyenv/versions/3.7.0/bin/python3"
npm ERR! gyp info spawn /Users/<username>/.pyenv/versions/3.7.0/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/<username>/.nodebrew/node/v15.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/<username>/<path>/blog/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/<username>/.nodebrew/node/v15.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/<username>/Library/Caches/node-gyp/15.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/<username>/Library/Caches/node-gyp/15.14.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/<username>/Library/Caches/node-gyp/15.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/<username>/<path>/blog/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 OpenEXR was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `OpenEXR.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! Package 'OpenEXR', required by 'vips', not found
npm ERR! gyp: Call to 'PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/11::/usr/local/opt/libffi/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g' returned exit status 0 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/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.5.0
npm ERR! gyp ERR! command "/Users/<username>/.nodebrew/node/v15.14.0/bin/node" "/Users/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/<username>/<path>/blog/node_modules/sharp
npm ERR! gyp ERR! node -v v15.14.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

I tried brew reinstall vips but the error is not resloved. Does anybody have any idea what this is?

Doubleton answered 9/8, 2021 at 10:9 Comment(1)
Based on upvotes, I think you should consider accepting my answer.Pilsen
D
0

I installed OpenEXR. I resloved this error.

https://github.com/AcademySoftwareFoundation/openexr/blob/master/INSTALL.md

Doubleton answered 9/8, 2021 at 10:37 Comment(0)
P
19

IDK why but ilmbase and OpenEXR have conflicting links.

This worked for me.

brew install openexr
brew unlink ilmbase
brew link openexr
brew install imath
brew link imath
Pilsen answered 7/9, 2021 at 10:10 Comment(3)
I can confirm this works on m1 + Monterey.Doeskin
updated to Monterey and had the same issue. The above instructions fixed it, thanksFloriaflorian
had the same issue with nextjs on big sur and this actually worked! thanks!Alidaalidade
D
0

I installed OpenEXR. I resloved this error.

https://github.com/AcademySoftwareFoundation/openexr/blob/master/INSTALL.md

Doubleton answered 9/8, 2021 at 10:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.