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

Heroku Toolbelt breaks rails

Successfully deployed treebook to heroku. But I'm getting the following error:

$ rails -v 

C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in     `report_activate_error': Could not find RubyGem railties (>= 0)       (Gem::LoadError)

from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in `activate_dep'

from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'

from C:/Program Files/ruby-    1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'

 from C:/RailsInstaller/Ruby1.9.3/bin/rails:18:in `<main>'

I was runnning Ruby 1.9.3 prior to deploying now I get the following

$ ruby -v 
ruby 1.9.2p290 (2011-07-09) [1386-mingw32]

Anyone have a fix for this???

9 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

This is pretty strange, Matthew. It appears that you have two different versions of Ruby installed. Is that a possibility?

I never installed the older version. The problem started when I installed the Heroku Toolbelt.

I have Ruby 1.9.3 installed at C:\RailsInstaller\Ruby1.9.3 .

Now when i call:

$ gem environment

RubyGems Environment:
- RUBYGEMS VERSION: 1.7.2
- RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Program Files/ruby-1.9.2/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: "C:/Program Files/ruby-1.9.2/bin/ruby.exe"
 - EXECUTABLE DIRECTORY: C:/Program Files/ruby-1.9.2/bin
 - RUBYGEMS PLATFORMS:
  - ruby
  - x86-mingw32
  - GEM PATHS:
  - C:/Program Files/ruby-1.9.2/lib/ruby/gems/1.9.1
  - C:/Users/MS Hartwig/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
  - :update_sources => true
  - :verbose => true
 - :benchmark => false
  - :backtrace => false
  - :bulk_threshold => 1000
 - REMOTE SOURCES:
- http://rubygems.org/

You can see that my gem path now points to:
C:/Program Files/ruby-1.9.2/lib/ruby/gems/1.9.1.

I never installed this. But I found a post here ( http://stackoverflow.com/questions/11161820/heroku-toolbelt-breaks-rails ) that leads me to believe Heroku Toolbelt installed it. I'm working on a Win7 machine so no RVM. Not sure what the solution is or even if there is one. I would appreciate any help to resolve this. Thanks.

bump

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

I'm not quite sure what the solution is here since there are definitely two conflicting rubies installed. Do you specifically need the tool-belt or can you get along with the heroku gem? Maybe try uninstalling the tool-belt and installing just the heroku gem.

darren higgins
PLUS
darren higgins
Courses Plus Student 1,077 Points

I have solved these types of issues before with a .gemrc . It's only a pointer, but I hope it helps.

Not sure if this will fix the problem but I looked into an RVM equivalent for windows and found a solution that RVM suggests called pik.

Here is a link for pik: https://github.com/vertiginous/pik

Hopefully this will help. Also, like darren suggested, a .gemrc file might help so that a certain gemset is loaded with your project.

I had the same issue (I'm also on Windows 7).

This isn't a very elegant fix, and admittedly, I don't know if could potentially lead to complications down the road since there are two different versions of Ruby installed on my machine (things have worked fine thus far).

Anyway, when I need to work on Treebook on localhost, I just moved the heroku-installed version of Ruby into a directory that the command line wouldn't "find" (C:). This will let you run "rails s" without running into your error. Then, when I need to actually deploy my updates to the Internet, I move the heroku-installed Ruby folder back to where it was.

Again, not the most elegant solution, and I'm sure there's a better way of doing things; however, it'll at least allow you to keep progressing in the meantime.

EDIT: I am going to try Jason's suggestion now and see if that fixes things.

Using pik now allows me to switch to ruby 1.9.3 so no issue there.

However, whenever I open a new command prompt it reverts to ruby 1.9.2 and I have to manually switch it with a pik command.

Does anyone know why this occurs?

I had the same trouble with heroku toolbelt installing version 1.9.2 and breaking my application. I simply went in and uninstalled ruby 1.9.2 from the control panel, ran the "$ gem environment" from the cmd prompt and saw that ruby was back to 1.9.3

Ran rails s and everything was back to good.

Is there a search feature for these treehouse forums? I was searching for a fix to (publickey) on heroku and found this problem on here, before I realized I had the problem on my win7.

I wanted to follow up with, after uninstalling ruby 1.9.2 I also had to uninstall Heroku from the control panel. I then simply ran "$ gem install heroku" from the cmd prompt and was good to go.