3

Rails 4 と Ruby 2 を使用したアプリケーションがあります。mongoid-paperclip を使い始めましたが、問題なく動作しています。

ImageMagick-6.8.6-8 をインストールしました。development.rb に Paperclip.options[:command_path] = "/usr/local/bin/" を追加しました。そして、私は mongoid-paperclip rmagick (~> 2.13.2) コカイン (0.5.1) を持っています

"has_mongoid_attached_file :avatar, :styles => { :small => "160x160!" }" を追加すると、次のエラーが発生し始めました: Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError

助けてください何時間も何時間も運がなかった。

4

4 に答える 4

2

NOTE: This solution is for OS-X machines and imagemagick installed via "brew"

Some of my students (I teach Rails at a dev bootcamp) had the exact same problem on their Mac OS-X machines. And, the following solution fixed them all.

The Cause

The cause of the problem is that jmagemagick is compiled using a wrong GCC compiler in your box. Although it probably has compiled into an executable (binary), however, when it runs, it fails due to linking errors (it's trying to dynamically load some dependencies, ie, libraries).

The Solution

You need to reinstall imagemagick using a correct GCC. If you have a Mac, please, follow the instructions below:

  1. Open XCode program (if you don't have it, install it)
  2. Go to Preference and open "Download" tab
  3. Download "Command line tool"
  4. After download is complete, open a terminal
  5. Run "brew reinstall imagemagick"

That should do it!

于 2013-12-06T19:05:28.927 に答える
0

これら2つのコマンドを実行すると、うまくいきました。libtool は keg-only であるため、必ず --force を使用してください。

brew install libtool --universal
brew link libtool --force
于 2015-04-13T06:49:34.893 に答える
0

1-同じ問題があり、 ldconfigコマンドを使用して必要なリンクを作成し、最新の共有ライブラリにキャッシュするようにダイナミックリンカーランタイムバインディングを構成すると、解決しました。

したがって、次のコマンドを使用する必要があります。

sudo ldconfig /usr/local/lib

実際には、 how-to-install-image-magick-and-setup-paperclip の手順を使用して imagemagick を再インストールすることをお勧めします。

development.rb2-ファイルに次のコードを追加する必要があります。

Paperclip.options[:command_path] = "/usr/local/bin/"
于 2014-12-16T11:42:38.840 に答える