0

I have a rails app running on passenger/apache 2.2.3/RHEL. Everything was working fine until I had to restart Apache. Once I did that, I got the following message:

Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

I'm not sure what to do, since the app was running fine before. I did touch restart.txt to try to restart it, deployed from Capistrano again, and removed/installed the rails gem again but nothing worked. rails -v prints Rails 2.3.4.

al.
  • 396
  • 2
  • 6

3 Answers3

1

I solved this a while ago by restarting apache with the command /etc/init.d/httpd restart rather than service httpd restart. Not sure why that worked, but it did. None of the environment.rb changes did anything.

al.
  • 396
  • 2
  • 6
0

I ran into a similar problem.... here is how I solved it...

First check your current gems environment by running "gem environment" in the terminal.

Look for GEM PATHS, for example, I had

/usr/local/lib/ruby/gems/1.8 /home/anatoly/.gem/ruby/1.8

I really install all the gems with sudo, so I cared only about the first one.

Next, add this to your path.

I am on Ubuntu 9.10, so for mean that means: sudo gedit ~/.bashrc

At the bottom of the file I added: export PATH=/usr/local/lib/ruby/gems/1.8:$PATH

in the config/environment.rb file for the rails app).. I added this on top: ENV['GEM_PATH'] = "/usr/local/lib/ruby/gems/1.8:#{ENV['GEM_PATH']}"

Save, log out, log back in. Cross your fingers.

0

It sounds like the rails app was built with either a previous version or new version of rails. To fix this, you'll need to cd to the topmost parent of the app (the parent of app,config, and other directories) and run:

rake rails:update

And/or update the config/environment.rb to the correct version.

RAILS_GEM_VERSION = ‘2.3.4′ unless defined? RAILS_GEM_VERSION

That said, if you got the app from someplace, running the above may not work. Get back to the machine that the app was built on and update rails as well as the app on that machine.

Rilindo
  • 5,078
  • 5
  • 28
  • 46