Search code examples
ruby-on-rails-3carrierwaveminimagick

Rails3 MiniMagick load error on choose_processor


A rails 3.2.13 application is running both on localhost and on server (in development mode). In localhost the application loads an image via carrierwave and MiniMagick properly.

On the server, an error is raised

undefined method `size' for nil:NilClass

, with the full stack leading of as such:

mini_magick (3.7.0) lib/mini_magick.rb:24:in `choose_processor'
mini_magick (3.7.0) lib/mini_magick.rb:64:in `mogrify?'
mini_magick (3.7.0) lib/mini_magick/image.rb:360:in `run_command'
mini_magick (3.7.0) lib/mini_magick/image.rb:171:in `valid?'
mini_magick (3.7.0) lib/mini_magick/image.rb:140:in `create'
mini_magick (3.7.0) lib/mini_magick/image.rb:48:in `read'
mini_magick (3.7.0) lib/mini_magick/image.rb:111:in `block in open'
mini_magick (3.7.0) lib/mini_magick/image.rb:110:in `open'
mini_magick (3.7.0) lib/mini_magick/image.rb:110:in `open'
carrierwave (0.9.0) lib/carrierwave/processing/mini_magick.rb:260:in `manipulate!'

Other postings allude to the fact that it may be
a miniMagick version issue. But the localhost version is the same as the server's, as is carrierwave, rails, OSX...

Based on the module documentation, it appears that no processor is being picked up. Thus the installation may have gone awry.

This question is edited as maybe two issues are at hand: different versions of MiniMagick are spawning different behaviours. Both are now separate questions.


Solution

  • The problem lies in Passenger v3, and the way it behaves on start-up with Apache. (Passenger 4 apparently does not have the issue)

    The solution is the same in any case as per this proposal by editing end of development and/or production environment files with:

      ENV['PATH'] = "/usr/local/bin:#{ENV['PATH']}"