14
votes

I'm in the middle of learning rails, and I'm trying to get heroku up and running. When I install the heroku toolbelt, though, produces a number of errors. If i try to run any rails command, I get something like this:

C:\Users\Ezra\Desktop\Sites\demo_app>rails -v 
C:/Program Files (x86)/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in `r
eport_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems
.rb:244:in `activate_dep'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems
.rb:236:in `activate'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems
.rb:1307:in `gem'
    from C:/RailsInstaller/Ruby1.9.3/bin/rails:18:in `<main>'

Additionally, running ruby -v gives me ruby 1.9.2p290, even though I have ruby 1.9.3 installed. In trying to fix this, I found that uninstalling ruby 1.9.2p290 would cause my ruby version to simply revert to 1.9.3p125, but after doing so heroku no longer works:

C:\Users\Ezra\Desktop\Sites\demo_app>heroku login
'"C:\Program Files (x86)\ruby-1.9.3\bin\ruby.exe"' is not recognized as an inter
nal or external command, operable program or batch file.  

Gem environment after installing heroku toolbelt:

RubyGems Environment:

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

Gem environment after uninstalling ruby1.9.2p290:

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.16
  • RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [i386-mingw32]
  • INSTALLATION DIRECTORY: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE: C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
  • EXECUTABLE DIRECTORY: C:/RailsInstaller/Ruby1.9.3/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-mingw32
  • GEM PATHS:
    • C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
    • C:/Users/Ezra/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

I'm running windows 7, and I'm not using rvm because cygwin makes me cry.
Any and all suggestions would be much appreciated.

6
Haven't worked on windows but the ruby executable in your logs C:/Program Files (x86)/ruby-1.9.3/bin/ruby.exe no longer exists as you said you uninstalled it from there. How did you uninstall it?rb512

6 Answers

12
votes

Also a newbie here, trying to get rails with heroku running. I ran into exactly the same problem today, first the "Could not find RubyGem railties" issue and then after uninstalling Ruby 1.9.2, the problem with heroku not working anymore. I found 2 ways around it, but not sure if either one is great.

Don't uninstall the ruby version that comes with the toolbelt. Instead either

(1): remove it from the PATH. For me, the toolbelt installation added c:\program files\ruby1.9.3 to my PATH system variable. I already had c:\ruby193 (where I installed ruby myself previously) in my user PATH variable. After removing the one that the toolbelt added from PATH, things started working.
(note: the c:\ruby193 should be placed before c:\program files\heroku\bin int the PATH system variable or else it wont work)

(2): alternatively, I moved c:\ruby193 from my user PATH to my system PATH. Re-installed the toolbelt, and both ruby and heroku work now. But I do have both versions of ruby in my PATH variable.

Not sure if either way is great because I suspect I now have two versions of ruby installed and being used depending on what I'm doing. But at least allowed me to move on to the next problem, now stuck trying to install heroku plugins.

I thought ruby on rails was supposed to make things easy. It's been 4 days of trying to configure 30 different new tools (end rant)

5
votes

I gave up on Heroku Toolbelt (uninstalled Heroku as well as the Ruby 1.9.2 runtime that came with it) and used the gems instead:

gem install heroku
gem install foreman
2
votes

Rui Viana you answer is good, but,

You should be worried about having two versions of ruby installed. I am a beginner but I hear this can lead to massive head aches later.

Since Herokubelt installs an additional version of ruby(1.9.2), I would remove this from both your user path (Path) and System path (PATH). Then uninstall ruby(1.9.2).

When I did this rails(1.9.3) and heroku belt were still working. I'm on windows 7 with rails 1.9.3

1
votes

Im suggesting you using linux in development of ruby on rails, I experienced develop in window before, it has so many issues that you can't able to counter it(out of your range). Besides,when you use some gem ,some gems configuration also different when you're in window. Changed to linux shld help u better in ruby on rails development :)

0
votes

On windows, I removed Ruby 1.9.2 (which Heroku installed) and edited the path in heroku.bat to point to the existing Ruby1.9.3

In my case it became:

:x64
set HerokuRubyPath=C:\RailsInstaller\Ruby1.9.3
goto launch
0
votes

it's probably something to do with the executable... when I type:

which heroku

the output is:

/usr/bin/heroku

and you should have it in your $PATH

...   :/usr/bin:  ...

the heroku gem is depricated, so download the 'heroku toolbelt'