Paperclip Error: NotIdentifiedByImageMagickError

2020-03-01 08:33发布

I've had a rails install with Paperclip working just fine for a while now and in a recent deploy it has broken. I believe it coincided with a gemfile update, because nothing else on the machine has changed. The error is:

Command :: file -b --mime :file
[paperclip] Error while determining content type: Command 'file -b --mime :file' returned 1. Expected 0

This is on a png file that I've verified to be valid. When I run 'file -b --mime' on the image I get:

image/png; charset=binary

I also get this afterwards:

Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/song_waveform_3010520121008-23335-165xag4.png20121008-23335-j8e18p is not recognized by the 'identify' command.>

I did a which file and it gave me /usr/bin so I tried setting the Paperclip.options[:command_path] = "/usr/bin/" in production.rb with no change.

I can't think of why this could be happening. Perhaps it's not pointing to the right directory? I'm a bit lost here.

7条回答
闹够了就滚
2楼-- · 2020-03-01 09:39

add gem "cocaine", "= 0.3.2"

then bundle install message

Bundler could not find compatible versions for gem "cocaine":   In Gemfile:
    paperclip (~> 3.0) x86-mingw32 depends on
      cocaine (~> 0.4.0) x86-mingw32

    cocaine (0.3.2)
查看更多
登录 后发表回答