严重错误:在 pkg-config 搜索路径中找不到包 OpenEXR
Posted
技术标签:
【中文标题】严重错误:在 pkg-config 搜索路径中找不到包 OpenEXR【英文标题】:sharp error: Package OpenEXR was not found in the pkg-config search path 【发布时间】:2021-10-13 01:02:59 【问题描述】:我在 Mac 上的 gatsby js 目录上执行了npm install
。
macOs 是大苏打
版本是 11.4。
gatsby 版本是 3.11.0
gatsby-plugin-sharp 版本是 3.11.0
显示此错误日志。
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 node-gyp@7.1.2
npm ERR! gyp info using node@15.14.0 | 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
我尝试了brew reinstall vips
,但错误没有得到解决。有人知道这是什么吗?
【问题讨论】:
基于upvotes,我认为你应该考虑接受我的回答。 【参考方案1】:我安装了 OpenEXR。我重新喜欢这个错误。
https://github.com/AcademySoftwareFoundation/openexr/blob/master/INSTALL.md
【讨论】:
【参考方案2】:IDK 为什么但是 ilmbase 和 OpenEXR 有冲突的链接。
这对我有用。
brew install openexr
brew unlink ilmbase
brew link openexr
brew install imath
brew link imath
【讨论】:
我可以确认这适用于 m1 + Monterey。 已更新到 Monterey 并遇到了同样的问题。以上说明已解决,谢谢 在 big sur 上与 nextjs 有同样的问题,这确实有效!谢谢!以上是关于严重错误:在 pkg-config 搜索路径中找不到包 OpenEXR的主要内容,如果未能解决你的问题,请参考以下文章
在 pkg-config 搜索路径中找不到软件包 libusb