RubyGem version error: rack(0.3.0 not ~> 1.0.0)

Trying to deploy in dreamhost with capistrano you get the error:

RubyGem version error: rack(0.3.0 not ~> 1.0.0)

Log in with ssh to your dreamhost account and then install the newer version of rack that is not yet installed in dreamhost:

gem install rack

That assumes that you have followed the instructions for setting up your local gems in dreamhost (here) and you already have a ~/username/.gems directory.

You may probably need to also add the following to your config/environment.rb :

ENV[‘GEM_PATH’] = ‘/home/USERNAME/.gems’

Note 09-Sep-2009
It seems that according to the dreamhost wiki we need to add the following to the config/environment.rb, instead of the line above:

if ENV[‘RAILS_ENV’] == ‘production’
ENV[‘GEM_PATH’] = ‘/home/USERNAME/.gems’
require ‘/home/USERNAME/.gems/gems/rack-1.0.0/lib/rack.rb’

to use the locally installed rack-1.0.0 gem, instead of the rack installed by dreamhost.