Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When the command of sudo rake db:migrate was executed the error message below appeared.

rake aborted!
RubyGem version error: rack(1.4.1 not ~> 1.1.0)

I guess the RubyGem version is later than the expected one. How can I downgrade the version of RubyGem?

share|improve this question
1  
Can you try again without the sudo part? It still should work. –  jrg Mar 7 '12 at 12:40
add comment

1 Answer 1

A "too new" version of RubyGems can indeed be a problem with some older applications (mostly those who still use Rails 2.x), but the error message you posted seems to indicate a different cause. Your applications wants a specific version of the Rack gem and the version(s) you have installed probably don't fit that request.

Your applications calls for rack ~> 1.1.0. That condition is matched by any version in the 1.1.x series, for example 1.1.0, 1.1.5 or 1.1.345, but not 1.2.0 or 2.0.0. You seem to have installed Rack in 1.4.1, that does not match the condition ~> 1.1.0.

Fortunately you can install different versions of the same gem side by side. To check which version(s) of Rack you have installed you can use

gem list -l rack

That lists are locally installed (because of the -l switch) gems whose name starts with 'rack'. In that list there's probably no version of the 1.1.x series.

To install a specific version of a gem you can use the --version=x.y.z option, in your case

gem install rack --version=1.1.0

Chances are that your migrations run through with that.

If you actually need to downgrade RubyGems, you first need to install the RubyGems gem ( :D ) in the version you want to downgrade to analogous to what you did above, e. g.

gem install rubygems-update --version=x.y.z

Then you can do execute the "update" (in your case, the downgrade)

gem update --system x.y.z

where x.y.z is the version number you want. Be aware that "updating" to a specific version has been introduced in RubyGems 1.5.1, so you can't downgrade to any version below that.

share|improve this answer
add comment

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.