SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Trouble with RubyGems version whilst executing 'rake' command

    I am fairly new to RoR and am following 'Simply Rails 2'.

    I am having an issue with the rake command:

    $ rake db:migrate

    When executing this command, the following error displays:

    Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Please `gem update --system` and try again.

    I have updated my RubyGems and checked the version which indicates that I do have version 1.3.1

    I have checked the internet for help with this but can't seem to find a solution to the problem..

    Any help with this would be appreciated

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,998
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    Not much help I'm afraid. But that error message comes from the config/boot.rb file
    Code Ruby:
    # Don't change this file!
    # Configure your app in config/environment.rb and config/environments/*.rb
    ......
          def rubygems_version
            Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
          end
    ......
            unless rubygems_version >= '0.9.4'
              $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
              exit 1
            end
    It gets the version from the config/environment.rb file
    Code Ruby:
    # Be sure to restart your server when you modify this file
    ......
    # Specifies gem version of Rails to use when vendor/rails is not present
    RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
    What version is specified in your config/environment.rb file?

  3. #3
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    enviroment.rb:

    # Specifies gem version of Rails to use when vendor/rails is not present
    RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION


    This seems odd as when i run:

    $ gem --version

    in the terminal it comes back as version 1.3.1

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,998
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    Apparently that value only comes into play when Gem::RubyGemsVersion is not defined. I looked in the GEM class file lib/rubygems/rubygems_version.rb and it's
    Code Ruby:
    # DO NOT EDIT
    # This file is auto-generated by build scripts.
    # See:  rake update_version
    module Gem
      RubyGemsVersion = '0.9.4'
    end
    So it most likely would be a bad idea to hack that file.

    Maybe if you updated Rake first?

  5. #5
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgive my ignorance but how would I update rake?

  6. #6
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I ran the following command:

    $ sudo gem update rake

    There was nothing to update. Then I ran:

    $ gem list

    and got the following results:

    *** LOCAL GEMS ***

    actionmailer (2.2.2)
    actionpack (2.2.2)
    activerecord (2.2.2)
    activeresource (2.2.2)
    activesupport (2.2.2)
    cgi_multipart_eof_fix (2.5.0)
    daemons (1.0.10)
    fastthread (1.0.1)
    gem_plugin (0.2.3)
    mongrel (1.1.5)
    rails (2.2.2)
    rake (0.8.3)
    rubygems-update (1.3.1)
    sqlite3-ruby (1.2.4)


    I guess that this means everything is up to date? However I am still getting the original error message from the rake command...

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,998
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    I'm guessing you must have more than 1 version of gems installed. One that is found with gem list, and another that is found with rake. Maybe in different locations eg. usr/lib/ruby and usr/local/lib/ruby ??

    AFAIK you can check with the command
    Code:
    gem environment
    to see if it's different from what
    Code:
    gem --version
    shows.

    I have Windows so things are a bit different for me, but if
    Code:
    sudo gem update --system
    doesn't work maybe this will? From what I could find searching, it helped a few others with the same problem. So it would probably be best to try this first.
    Code:
    gem install rubygems-update 
    update_rubygems
    There's got to be some way to get everything in sync. Installations sure require a lot of patience and persistance. Aaarrrggghhh!!!

  8. #8
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    gem --version returns: 1.3.1

    gem environment returns:

    RubyGems Environment:
    - RUBYGEMS VERSION: 1.3.1
    - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]
    - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
    - RUBY EXECUTABLE: /usr/local/bin/ruby
    - EXECUTABLE DIRECTORY: /usr/local/bin
    - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-9
    - GEM PATHS:
    - /usr/local/lib/ruby/gems/1.8
    - /Users/timrudling/.gem/ruby/1.8
    - GEM CONFIGURATION:
    - :update_sources => true
    - :verbose => true
    - :benchmark => false
    - :backtrace => false
    - :bulk_threshold => 1000


    I can see that the installation directory and the executable directory differ, but apart from that, this doesn't mean a great deal to me. I also found that others had used:

    gem install rubygems-update
    update_rubygems


    but this had the same result for me (getting a little frustrated now). Is there a way of uninstalling everything, i.e. Ruby and Rails and then re-installing: I used the same installation on my laptop and it works fine??

  9. #9
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,998
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    Believe me, I know how frustrating installations can be. As I have an older Windows system it usually takes quite an effort to find compatible new software that will still work.

    My "version" and "environment" are
    Code:
    C:\ruby>gem --version
    0.9.4
    
    C:\ruby>gem environment
    RubyGems Environment:
      - VERSION: 0.9.4 (0.9.4)
      - INSTALLATION DIRECTORY: C:/RUBY/lib/ruby/gems/1.8
      - GEM PATH:
         - C:/RUBY/lib/ruby/gems/1.8
      - REMOTE SOURCES:
         - http://gems.rubyforge.org
    It may be inconsequential but my installation directory and gem path are the same.

    As you have 2 gem paths, does one contain ver. 1.3.1 and the other 1.0.1 ??
    Before you uninstall everything (is there an uninstall.exe file there ??) it may be helpful to delete the 1.0.1 folder wherever it is (assuming there is one somewhere) and doing another update first. Of course if the problem is a corrupt file somewhere, then a reinstall would probably be easier than trying to find the problem file(s).

  10. #10
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked out all the gem directories and, although the directory paths differed, they all contained version 1.3.1.

    I think a fresh install is the best option. Do you know the commands to fully uninstall everything? What would I need to uninstall? Just Rails and Ruby, or is it a little more complicated than that?

    I looked around for info but couldn't find any good resources..

    I really appreciate your help..

  11. #11
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,998
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    I wouldn't uninstall your database or server, just Ruby. For me uninstalling -- should be -- as simple as running uninstall.exe But it depends on what system you have. If you do a search for
    "how to uninstall" Ruby Mac|Ubuntu|whatever
    do you find anything helpful?

  12. #12
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the rubygems-update line bothers me, here. Not sure if it's coincidence, but I have 1.3.1, and do not have that file.

    Since gems are what's causing the issue, I'd start by trying to get rid of it, and then rebuilding it. I suspect there are two copies of it on your system. Start first with sudo gem uninstall rubygems-update and after that has completed, see if you can still reach gem. If so, there's a second version of it there that needs updating, so try sudo gem update -- system to see if you can update that copy in place.

  13. #13
    SitePoint Zealot
    Join Date
    Feb 2003
    Location
    Akron, OH, USA
    Posts
    102
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gethyn1 View Post
    I am fairly new to RoR and am following 'Simply Rails 2'.

    I am having an issue with the rake command:

    $ rake db:migrate

    When executing this command, the following error displays:

    Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Please `gem update --system` and try again.

    I have updated my RubyGems and checked the version which indicates that I do have version 1.3.1

    I have checked the internet for help with this but can't seem to find a solution to the problem..

    Any help with this would be appreciated
    As stated before it sounds like you have more than one version of gems installed. Try running "gem cleanup" to remove all old versions of gems. Then run "rake update_version" to update your rails app. I think that all should be well if this is the problem.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •