Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.