Posted by Pete McBreen 18 Jan 2011 at 21:42
In a shared hosting environment, the system does not always have all of the gems you need, but when a gem is installed locally under your own account, mongrel or passenger does not see where the gems are and you get the great error message:
Missing these required gems bluecloth
You get this message from mongrel even after running
rake gems:install and having it report that the gem is successfully installed.
The Fix for Missing these required gems
GEM_PATH to point to your local gems as well as the system gems, but you cannot just set it in
.bashrc, since apache runs under a different user and does not see your scripts. Hence when mongrel runs, it does not see the locally installed gems.
preinitializer.rb that lives in the
config directory can set the
GEM_PATH and then Mongrel can see the locally installed gems.
config/preinitializer.rb needs to contain the following
ENV['GEM_PATH'] = '/home/pete/ruby/gems:/usr/lib/ruby/gems/1.8' Gem.clear_paths
Obviously you will need to replace the path to my local rubygems
home/pete/ruby/gems with your own local gem path.
A hat tip to Damien White for pointing me to this fix. Here’s hoping that this extra link moves his site up in the google listing for the query mongrel “Missing these required gems”