Rake dependency error


#1

Rake no longer works for me at all. I think this is a result of having
upgraded some gems (including the RubyGem system itself), but not
others, some kind of dependency problem. (I actually didn’t mean to
upgrade this stuff, but typed stuff into the wrong terminal window. Doh!
Don’t think there’s any good way to ‘downgrade’ RubyGems itself?).

But now, every time I try to run rake, to do anything at all, I get:

[rochkind@app01 ~]$ rake -v
/usr/bin/rake:17: undefined method `require_gem’ for main:Object
(NoMethodError)

Any ideas how I fix this?

Jonathan


#2

Hmm, actually, responding to my own question as soon as I posted it,
uninstalling and then reinstalling the latest rake seems to have done
it:

“sudo gem uninstall rake -v 0.8.3”

“sudo gem update rake”.

rake -v runs again, at least.

Still wondering if there’s any good way to ‘downgrade’ the RubyGems
installation itself, that I accidentally upgraded with “gem update
–system” before I was really ready to. All the individual gems I can
uninstall versions I don’t want (or use other solutions to have my
applications using the versions I want), but the RubyGems system itself,
once I upgraded accidentally with --system, there seems to be no good
way to go back?

Jonathan

Jonathan R. wrote:

Rake no longer works for me at all. I think this is a result of having
upgraded some gems (including the RubyGem system itself), but not
others, some kind of dependency problem. (I actually didn’t mean to
upgrade this stuff, but typed stuff into the wrong terminal window. Doh!
Don’t think there’s any good way to ‘downgrade’ RubyGems itself?).

But now, every time I try to run rake, to do anything at all, I get:

[rochkind@app01 ~]$ rake -v
/usr/bin/rake:17: undefined method `require_gem’ for main:Object
(NoMethodError)

Any ideas how I fix this?

Jonathan


#3

Your solution didn’t work for me. Even after uninstalling all versions
of rake and reinstalling. rake -v still doesn’t run.

“sudo gem uninstall rake -v 0.8.3”

“sudo gem update rake”.

rake -v runs again, at least.

Still wondering if there’s any good way to ‘downgrade’ the RubyGems
installation itself, that I accidentally upgraded with “gem update
–system” before I was really ready to. All the individual gems I can
uninstall versions I don’t want (or use other solutions to have my
applications using the versions I want), but the RubyGems system itself,
once I upgraded accidentally with --system, there seems to be no good
way to go back?

Jonathan


#4

I fixed the problem by going into /usr/bin/rake
and changing line 17 to just gem instead of require_gem

  1 #!/usr/bin/ruby
  2 #
  3 # This file was generated by RubyGems.
  4 #
  5 # The application 'rake' is installed as part of a gem, and
  6 # this file is here to facilitate running it.
  7 #
  8
  9 require 'rubygems'
 10 version = "> 0"
 11 if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
 12   if Gem::Version.correct?(ARGV[0][1..-2])
 13     version = ARGV[0][1..-2]
 14     ARGV.shift
 15   end
 16 end
 17 gem 'rake', version
 18 load 'rake'