Rmagick error while 运行 Rails 3.2 应用

Rmagick error while running Rails 3.2 application

我正在处理一个旧项目,该项目有 Ruby 版本 1.9.3p 和 Rails 3.2.13

这是我的Gem文件:

gem 'rails', '3.2.13'
gem 'mysql2', '~> 0.4.1', :group => [:production, :staging]
gem "paperclip", "~> 2.3"
gem "rmagick", "~> 2.13.1", :require => 'RMagick' 

当我 运行 捆绑包安装时,出现如下错误:

An error occurred while installing rmagick (2.13.2), and Bundler cannot continue. Make sure that gem install rmagick -v '2.13.2' succeeds before bundling.

当我 运行 上面的命令时,我得到的错误是:

abcuser@myvm:~/Desktop/report_master$ gem install rmagick -v '2.13.2' Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension.

current directory: /home/abcuser/.rvm/gems/ruby-1.9.3-p551@proj/gems/rmagick-2.13.2/ext/RMagick

/home/abcuser/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20160603-8257-drbei5.rb extconf.rb checking for Ruby version

= 1.8.5... yes checking for gcc... yes checking for Magick-config... no Can't install RMagick 2.13.2. Can't find Magick-config in /home/abcuser/.rvm/gems/ruby-1.9.3-p551@proj/bin:/home/abcuser/.rvm/gems/ruby-1.9.3-p551@global/bin:/home/abcuser/.rvm/rubies/ruby-1.9.3-p551/bin:/home/abcuser/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

* extconf.rb 失败 * 由于某种原因无法创建 Makefile,可能缺少必要的库 and/or headers。查看 mkmf.log 文件以获取更多详细信息。您可能需要配置 选项。

提供的配置选项:--with-opt-dir--without-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=/home/abcuser/.rvm/rubies/ruby-1.9.3-p551/bin/ruby

要了解此扩展编译失败的原因,请查看 mkmf.log 可以在这里找到:

/home/abcuser/.rvm/gems/ruby-1.9.3-p551@proj/extensions/x86-linux/1.9.1/rmagick-2.13.2/mkmf.log

extconf 失败,退出代码 1

Gem 个文件将保留安装在 /home/abcuser/.rvm/gems/ruby-1.9.3-p551@proj/gems/rmagick-2.13.2 为 检查。结果记录到 /home/abcuser/.rvm/gems/ruby-1.9.3-p551@proj/extensions/x86-linux/1.9.1/rmagick-2.13.2/gem_make.out

请帮我解决这个错误。

ERROR: Error installing rmagick: ERROR: Failed to build gem native extension.

这可能是因为您没有安装 node.js :

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

或者因为您没有安装 RMagick:

sudo apt-get install imagemagick libmagickwand-dev

一点小建议: 注意 ImageMagick 安全问题。 know more