views:

645

answers:

3

When I try to deploy my rails app to my shared hosting (dreamhost) I get this error:

can't activate rack (~> 1.0.1, runtime) for [], already activated rack-1.0.0 for []

So I want to freeze the rack gem in my dev environment, and add it to the project, but even though I have this in my config/environment.rb:

config.gem 'rack'

Doing a rake gems:unpack:dependencies doesn't freeze the gem.

ajmbp:trunk ajl$ rake gems:unpack:dependencies
(in /Users/ajl/dev/site/trunk)
ajmbp:trunk ajl$ ll vendor/gems/
.svn/           haml-2.2.14/    net-ssh-2.0.16/

I tried adding another gem to the config.gem just to test (RedCloth) and that does work as expected, but no luck with rack.

Any ideas? Thanks!

A: 

Have you checked your environment variables (RUBY_GEMS I think it is, or something like that)? Also, your environment.rb and (if you use fastcgi) your .fcgi.

Make sure the paths are ordered from highest priority to lowest.

glebm
A: 

See this article.

Any gem that is loaded in your Rakefile (e.g. metric_fu, vlad, etc) is considered to be a ‘framework gem’ by Rails, and such gems are not unpacked. Given that the vendor/gems directory is not yet in the load path when the Rakefile is loading, this is probably a good idea.

In other words, if you have a library that provides Rake tasks, or is otherwise necessary for your .rake files to be valid, don’t expect “config.gem” and friends to handle it for you.

For Dreamhost see their own documentation on installing your own gems. Or see this excellent article on how to load your own packages and gems (be warned it's not for the faint of heart).

But all my reading is telling me that you may still run into trouble because of the way Passenger may be using the Rack version installed by Dreamhost.

Good Luck.

Tony Fontenot
+1  A: 

Are you trying to upgrade to Rails 2.3.5? Read this thread: http://stackoverflow.com/questions/1814856/bypassing-rack-version-error-using-rails-2-3-5/1925463

Short answer: You can't. But Dreamhost will upgrade Rails on Monday.

someone
To follow-up - actually yes you can, but it's complicated and much easier just to get dreamhost to move you to a newer server.
Taryn East