运行捆绑安装时发生错误

问题描述 投票:0回答:1

我看到了像this这样的帖子,并尝试了那里的建议,但问题仍然存在,所以再次在这里发帖。预先感谢!

当我运行

DEPENDENCIES_NEXT=0 bundle install
时,我收到以下错误:

Can't install RMagick 2.16.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/xxxxxxxxxxxx/.rvm/rubies/ruby-2.6.6/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/xxxxxxxxxxxx/.rvm/gems/ruby-2.6.6@yyyyyyyyy/extensions/-darwin-22/2.6.0/rmagick-2.16.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/xxxxxxxxxxxx/.rvm/gems/ruby-2.6.6@yyyyyyyyy/gems/rmagick-2.16.0 for inspection.
Results logged to /Users/xxxxxxxxxxxx/.rvm/gems/ruby-2.6.6@yyyyyyyyy/extensions/-darwin-22/2.6.0/rmagick-2.16.0/gem_make.out
......
.....

An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.

In Gemfile:
  gruff was resolved to 0.7.0, which depends on
    rmagick

我尝试重新安装和重新链接图像,并且执行成功:

yyyyyyyyy@bcd074b3401b xxxxxx % brew unlink imagemagick@6
Unlinking /opt/homebrew/Cellar/imagemagick@6/6.9.13-4... 0 symlinks removed.
yyyyyyyyy@bcd074b3401b xxxxxx % brew link --force imagemagick@6

Linking /opt/homebrew/Cellar/imagemagick@6/6.9.13-4... 76 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

gem install rmagick
已成功安装
rmagick-5.3.0
,但没有帮助。

我认为根本原因是gem的安装是默认的

rmagick-5.3.0
,当我尝试安装2.16.0时,我看到了完全相同的bundle错误消息。 gem的版本是3.0.9

我使用的是MacOS Ventura M1 Pro

rubygems bundle rmagick
1个回答
0
投票

我在更新到 macOS Sonoma 后遇到了同样的问题。以下是适用于需要 RMagick 2.16.0 的 Rails 应用程序的步骤:

  • brew install --build-from-source imagemagick@6
  • 我执行了成功安装后列出的建议:

如果您需要在 PATH 中首先包含 imagemagick@6,请运行: echo '导出 PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

为了让编译器找到 imagemagick@6,您可能需要设置:export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib" 导出 CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"

要让 pkg-config 找到 imagemagick@6,您可能需要设置:export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"

  • gem 安装 rmagick --版本 2.16.0

  • 捆绑安装

您的里程可能会有所不同,因为我们的设置之间存在一些差异:

  1. 您使用的是 macOS Ventura。我使用的是 macOS Sonoma 14.2.1。
  2. 您正在使用 ruby-2.6.6。我的应用程序使用 ruby-2.4.1(通过 rvm)。
© www.soinside.com 2019 - 2024. All rights reserved.