Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

A rails server issue

So I been working on The "Build a Simple Ruby on Rails Application" Project, which was going fine yesterday but when I try to start up the server today I am getting:

C:\Sites\treebook>rails s
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:636:in `report_activate_error': Could
    not find RubyGem railties (>= 0) (Gem::LoadError)
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:141:in `activate'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
        from C:/RailsInstaller/Ruby1.9.3/bin/rails:22

I looked for a possible fix but the one i found on here that was similar said to start the command prompt as admin and do:: gem install bundler bundle rails server

but doing that achieves basically:

C:\Sites\treebook>gem install bundle
    ERROR:  Error installing bundle:
        bundler requires Ruby version >= 1.8.7

And if i continue with the bundle line it spits out the same thing as trying rails s / rails server. I used the newest rails installer if that helps. If anyone can help, Thanks!

4 Answers

Did you install ruby on rails using the railsinstaller.org or rvm? Double check your installed versions by typing ruby -v and rails -v in terminal.

I used the railsinstaller.org download. This is what I get doing ruby -v and rails -v

C:\Sites\treebook>ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

C:\Sites\treebook>rails -v C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:636:in report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError) from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:141:inactivate' from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem' from C:/RailsInstaller/Ruby1.9.3/bin/rails:22

Oh... I wonder if I had an old version of Ruby and forgot I had, that I never uninstalled. Could that possibly be what is doing it? For some reason that finally occurred to me.

Are you working on a Windows PC or a Mac Computer? I am not sure about Windows, but Macs come preinstalled with ruby 1.8.6. You should not have to uninstall it. I don't see that rails even executed in the command line. Make sure you run them as two separate commands: ruby -v (enter, wait to load, once loaded) rails -v (enter, wait to load). I installed ruby on rails using RVM (https://rvm.io/rvm/install/). Why I am telling you this? In order to use RVM (and possibly rails installer?), you have to initialize RVM. Take a look at the code below to see what I mean.

JB:~ joebruno$ rails s
Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.
JB:~ joebruno$ rails -v
Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.
JB:~ joebruno$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
JB:~ joebruno$ source ~/.rvm/scripts/rvm
JB:~ joebruno$ rails -v
Rails 3.2.13
JB:~ joebruno$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
JB:~ joebruno$ cd ~/inoteish

JB:inoteish joebruno$ rails s
 => Booting Thin
 => Rails 3.2.13 application starting in development on http://0.0.0.0:3000
 => Call with -d to detach
 => Ctrl-C to shutdown server
 >> Thin web server (v1.5.1 codename Straight Razor)
 >> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

Also, make sure you are working in the correct directory. If not, change your directory (cd) and move to your project location, which will default to your user location and move down from there. For instance, lets say you have a project called treebook in your documents folder (which is in your user folder). To change directories to this folder might look something like this: ~/documents/treebook.

BTW if you end up trying to install Ruby on Rails using RVM after you have installed the files using railsinstaller.org, you may run into some trouble (I did). You may need to manually edit files from your .bash_profile and other similar files. It took me FOREVER to find these files. They are hidden files in your username directory. You can view by downloading Textwrangler ->File -> Open and check the box that says view Hidden files.

Sadly on a Windows PC

I did try the gem install rails once earlier today though, because i was trying to do anything to get it to work but it was basically giving the same error message. I did finally get it to work though.

Basically when it hit me it might be an old install from when I tried to learn Ruby sometime ago, I found the files of the old install and uninstalled it, now everything is working just fine it seems. Still sorta odd considering yesterday it was also working just fine till this morning. Guessing it is just Windows being its evil quirky self.

Thank you so much though for the help!