undefined local variable or method `version_requirements’ for # (NameError)

Posted February 16, 2011 under Rails

So I upgraded to the latest rubygems the other day…only to be presented with this wonderful little error!

undefined local variable or method `version_requirements' for #<Rails::GemDependency:0x1022cc1c8> (NameError)

I thankfully came across this comment on a gist on github of someone having the same error.

The solution is fairly simple. Just run the following commands to go back to the previous version of rubygems and you should be fine:

$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems

That simple revert seems to fix any issue I have with running Rails 2.3 applications. If anyone knows more about the issue and how we can fix it to use rubygems 1.5.x with Rails 2.3 that would be great!

If you liked this post, follow me on Twitter or subscribe to my RSS feed.

Discussion

  • http://twitter.com/philipsampaio Philip Sampaio

    Thanks for sharing! =)
    Problem solved, but I just ran the install command and update.

  • Shen Siwei

    Thank you very much.
    @Philip, I have to uninstall the 1.5.x ruby gem.

  • http://paulschreiber.com/blog/ Paul Schreiber

    Upgrading from Rails 2.3.2 to 2.311 allowed me to use RubyGems 1.5.2 without problems.

  • http://excid3.com Chris Oliver

    Thanks for the feedback. I use a mix of Rails 2.3 and 3.0 applications so upgrading went haywire for 2.3 but not 3.0. It might just be that our project is using an older version of Rails 2.3 and we should upgrade it.

  • nikunj

    [Solution]

    To solve the issue please visit the link
    http://www.redmine.org/issues/7516#note-3

    nikunj

  • Mike

    Thanks, this was a big help getting an old rails 2.2.2 app running on a new machine!

  • PJSCopeland

    So if I get the response

    RubyGems 1.4.2 installed
    ERROR:  While executing gem ... (Errno::ENOENT)
        No such file or directory - README

    What else do I need to do?

  • Pingback: 安裝 Redmine 1.1.1 遇到 version_requirements 的暫時解法 | TaopaiC 的異想世界

  • Pingback: Code Woes: “undefined local variable or method `version_requirements’” | imarichardson.com

  • http://profiles.google.com/samion1327 Sam Petrenko

    Thank you it’s working

    Rails 2.3.5 not working with 1.5.0 gems

    fixed by revert to 1.4.2

    – RUBYGEMS VERSION: 1.4.2
    – RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

  • http://profiles.google.com/matt.connolly.au Matt Connolly

    I’m using redmine 1.1.1 and I just upgraded Rails to 2.3.11 and it fixed this for me.

  • daudi

    This hack worked for me:
    Phillip Koebbe from Ruby on Rails suggested inserting following code between bootstrap and initialize section of enviroment.rb. And it works.

    if Gem::VERSION >= “1.3.6″
    module Rails
    class GemDependency
    def requirement
    r = super
    (r == Gem::Requirement.default) ? nil : r
    end
    end
    end
    end

    see: http://www.redmine.org/issues/7516

  • http://excid3.com Chris Oliver

    Oh very interesting, thanks for this!

  • http://profiles.google.com/eafkhami Ehsan Afkhami

    thanks very helpful…

  • http://www.facebook.com/people/Ehsan-Afkhami/580040844 Ehsan Afkhami

    pp

  • Guest

    iii

  • bandar

    Yesssss

  • Anonymous

    Thanks! This worked for me with redmine and a recent change they did behind the scenes on hostmonster! Much appreciated!

  • Marcus Rohrmoser

    Thx!

  • http://profiles.google.com/sparcdr James Cornell

    Git head of Redmine works on OpenSUSE 11.4 x86_64.

  • Quentin Flayac

    Perfect!! Many thanks

  • Chai2

    worked for me too!!

  • Stanislaw

    Thanks!

  • Marco Metz

    Thanks a lot… 

  • http://twitter.com/rtdp Ratnadeep Deshmane

    that hakc didn’t worked for me,

    but changing gem version worked.

  • http://excid3.com Chris Oliver

    Confirmed that this does work for me using Rails 2.3.5.

  • Gkhag

    Thanks a lot. This https://makandracards.com/makandra/1109-fixing-undefined-local-variable-or-method-version_requirements-for-rails-gemdependency-0x-nameerror worked for me.