Thursday, March 31, 2011

Getting `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) while creating new rails application after installing pik gem

In my previous post "steps-to-install-pik-add-ruby-to-pik.html", described how to install pik on windows, adding ruby version to pik and switching between various ruby versions through pik.

After installing pik, added Ruby 1.9.2 and then switched to Ruby 1.9.2:

>pik 192
>pik list
   187: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
* 192: ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

When I checked rails version after switching Ruby version to 1.9.2, I got error.

>rails -v
'rails' is not recognized as an internal or external command,
operable program or batch file.

Tried to create new rails application, but again got error:
>rails new demos
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
        from C:/Ruby187/bin/rails:18:in `<main>'

To fix this problem, I installed rails gem in Ruby 1.9.2
>gem install rails

And then I checked rails version.
>rails -v
Rails 3.0.5

I was able to create new rails application. 
On my existing rails application which has already been updated to Rails -v 3.0.3, I ran 'bundle install' and it executed and installed the gems listed in Gemfile.

3 comments:

  1. Thanks... that helped me out :)

    ReplyDelete
  2. thanks. very helpful for when i upgraded to 1.9.2 and rails stopped working.

    ReplyDelete
  3. i really take my time to thank you...

    i know u deserve more for the efforts, but thanks is all i can give..:)

    ReplyDelete