Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby.exe not recognised when trying to login & use heroku

When trying to create a heroku app and push up to it via git, I get the following error:

$ heroku create
' "C:\Program Files <x86>\ruby-1.9.2\bin\ruby.exe" is not recognized as an
internal or external command, operable program or batch file.

However,

$ ruby -v
ruby 1.9.3p125 <2012-02-16> [i386-mingw32]

I've checked the PATH environment and it definitely contains "C:\Program Files (x86)\ruby-1.9.2\bin". Interestingly too, when navigating to this directory, it doesn't actually contain a file named ruby.exe. Is that normal?

Why when I specifically try to deploy to Heroku does this error come up? I have no idea what's going on...please help!

like image 494
oceaurill Avatar asked Oct 25 '12 06:10

oceaurill


2 Answers

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)

like image 77
Dipak Panchal Avatar answered Nov 15 '22 10:11

Dipak Panchal


Another thing you can do, (it works for me) is edit the \bin\heroku.bat.

In the file the reference for the Heroku Ruby Installation Path is marked to Program Files. It comes default in the installation. Change to the current Ruby Installation Path.

In my case, I want only one version of ruby in my machine. So, I uninstalled the ruby that comes with heroku, and installed the 1.9.3. And simply changed the batch file.

I hope that helps. Enjoy.

like image 41
Andrey Luiz Avatar answered Nov 15 '22 11:11

Andrey Luiz