1

I've been getting this error after installing rvm and rails with rvm. Can anyone help me out?

/Library/Ruby/Site/1.8/rubygems.rb:779:in report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) from /Library/Ruby/Site/1.8/rubygems.rb:214:in activate' from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem' from /usr/bin/rails:18

Thanks!

readmymsg123
  • 643
  • 2
  • 8
  • 14
  • 2
    try 'rvm list' and then 'rvm use ' you need to load the environment rails live in first. – sled May 10 '11 at 21:11
  • I did that and now I get this error: Could not find RubyGem rails (>= 0) (Gem::LoadError) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in `activate_dep' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem' from /usr/local/bin/rails:18:in `
    ' --> it seems like it cant even find rails? I'm so confused T_T
    – readmymsg123 May 10 '11 at 21:15
  • ok try: 'rvm gem list' does rails show up there? – sled May 10 '11 at 21:22

2 Answers2

1

Couple of things to look at:

  • Make sure Rails is indeed installed. I'm bringing up this point because you mentioned that you installed Rails with RVM, which is inaccurate. You install Rubies with RVM but you install Rails with Bundler (you can see Bundler as an RVM for gems rather than rubies). So ensure that you have a line that says gem 'rails' in your Gemfile and then run bundle install.

  • As pointed out by other answers, make sure you are using the right ruby and gemset (where you installed the Rails gem). To do so run rvm use <your_ruby>@<your_gemset>.

mbreining
  • 7,739
  • 2
  • 33
  • 35
  • Is there a way to automate the rvm use 1.9.2@rails3 command so that I don't have to enter it every single time? Thanks! – readmymsg123 May 10 '11 at 23:16
  • Yes. Run `rvm --default use 1.9.2@rails3`. This will set 1.9.2@rails3 as your default ruby/gemset so you can be sure to be using 1.9.2@rails3 whenever you open a new terminal. – mbreining May 10 '11 at 23:20
  • Wow, now it throws this error: /Users/alexwang/.rvm/gems/ruby-1.9.2-p180@rails3/gems/mysql2-0.2.7/lib/mysql2.rb:8:in `require': dlopen(/Users/alexwang/.rvm/gems/ruby-1.9.2-p180@rails3/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) ---> very frustrating =( – readmymsg123 May 10 '11 at 23:53
  • That's a different problem. Something to do with your mysql client library that cannot be found... as you've probably figured out. Did a quick search and found [this](http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serve). – mbreining May 10 '11 at 23:56
0

Are you sure you're actually in the RVM Ruby right now? I often hit this error when I forget to enter rvm use MY_RUBY_VERSION. It's looking for the rails gem, but can't find it.

Matchu
  • 83,922
  • 18
  • 153
  • 160
  • Yeah, I have the same exact problem! Is there a way that we can automate the "rvm use 1.9.2@rails3" command so that we dont have to enter it every single time? It's quite annoying to do so, but I guess I can live with it. – readmymsg123 May 10 '11 at 23:15
  • See my comment under my answer. – mbreining May 10 '11 at 23:40