1

I've followed the instructions in https://devcenter.heroku.com/articles/rails3 which is missing a lot of crucial information for Windows installs, but managed to get past most of my problems with Google searches.

Here's what I've done:

  1. Installed Heroku Toolbelt
  2. Tried "heroku login" but ssh-keygen wasn't found so added C:\Program Files (x86)\Git\bin; to %PATH% -- was then able to generate key and log in
  3. Tried "rails new myapp" but got the error in the title of this thread (rails command not found)
  4. Tried "gem install rails" but the "gem" command also not found. Added C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\Heroku\ruby-1.9.2\bin; to %PATH%.
  5. Tried "gem install rails" again. Command runs but hits error saying devkit not installed.
  6. Installed devkit and added C:\Program Files (x86)\Heroku\ruby-1.9.2\devkit;C:\Program Files (x86)\Heroku\ruby-1.9.2\devkit\bin; to %PATH%
  7. Finally "gem install rails" completes successfully
  8. Tried "rails new myapp" again but still get the error 'rails' is not recognized as an internal or external command, operable program or batch file.
  9. Searched my entire C: drive for "rails.*" but no executable found anywhere. So, "gem install rails" completed with no errors but there's no "rails" executable anywhere on my system.

Any help?

PS - Please no "you typed xxx wrong" answers. I may have mistyped something in this question but I always triple-check that I'm typing commands with proper case and spelling. Also, I have been exiting and opening new command prompts to reload PATH.

ChaosFreak
  • 101
  • 1
  • 2
  • 6

4 Answers4

2

I think you need to get rid all of your installed Ruby especially the PATH and download Ruby on Rails for Windows (http://rubyforge.org/frs/download.php/76862/railsinstaller-2.2.1.exe) Once you installed this, the installer will do the setting and everything including setting up the environment variables. After you installed, I think you need to restart your laptop. You can open "command prompt with Ruby on Rails" directly from the one you installed... then try rails command (such as rails c, rails new, etc) I've tried this on my windows 7 64bit laptop and it works perfectly fine :D

Good luck!

Romans 8.38-39
  • 456
  • 4
  • 14
  • I reinstalled Rails using the Rails installer for Windows, then reinstalled the Heroku toolbelt. This got me past this problem. But soon I faced another problem... installing a Gem that needed ImageMagick, but the windows Gem for ImageMagic is a version behind the current release so I'm stuck again. I think the moral of the story is--don't try to run Rails on Windows. I will be installing a virtual ubuntu machine and using that for development as suggested by @cfeduke below... – ChaosFreak Jul 10 '13 at 20:03
  • Sorry, I never used rmagick gem before, but if you're still trying on windows, this information might be useful http://stackoverflow.com/questions/14593055/how-to-install-rmagick-gem-on-windows https://github.com/rmagick/rmagick/wiki – Romans 8.38-39 Jul 11 '13 at 02:38
1

See if you have any luck with Rails Installer.

An alternative, and I know this sounds like a very bad idea to you right now, is to install VirtualBox (free) with Ubuntu as a virtual machine and develop on Linux for a while using an editor like SublimeText 2 or vim. You'll definitely have an easier time following along in tutorials and not get frustrated with the language due to the operating system.

cfeduke
  • 23,100
  • 10
  • 61
  • 65
  • Yeah, I have an ubuntu box I could use but the laptop I take with me is Windows and it's a pain to SSH into the ubuntu box to do my work. More info: it seems "gems install rails" didn't complete with no errors. I tried to re-run "gems install rails -include-dependencies and it installs a bunch of other gems but then craps out with another error: "ld.exe: cannot find -lmsvcrt-ruby191" A Google search on this turns up ZERO hits. HELP!! – ChaosFreak Jul 10 '13 at 03:44
  • Try the Rails Installer. I haven't used Windows in years but it supposedly makes Rails a thing you can do on Windows, if you are a masochist. (VirtualBox creates a virtual machine so you don't need to dump Windows or even dual boot to develop in a GUI Linux desktop.) – cfeduke Jul 10 '13 at 03:50
1

I think you just need to close the windows explorer and all cmd window. And then open windows explorer again, and start command prompt again in the ../ruby/rails

Oh, by the way you can use shift + right mouse click, to get menu "Open command window here" in the explorer.

Faruk
  • 5,438
  • 3
  • 30
  • 46
0

This message means that Rails cannot be found. This might be due to the fact that you haven’t installed Rails or it may be due to the fact that the path to Rails cannot be found. This may also occur when you install Rails using a ‘special’ installation of Rails such as the InstantRails installer. We do not support custom Rails installers. We recommend that you do a ‘normal’ Rails installation. To do this from within Ruby In Steel, ensure that you are connected to the Internet, then select Gems from the Ruby menu and enter:

rails –include-dependencies

If you prefer to run the gem from the system prompt, you should enter:

gem install rails –include-dependencies

Alternatively, you can download and install rails from the Ruby On Rails web site:

http://www.rubyonrails.org/

To ensure that Rails is installed, go to the system prompt and enter:

rails

You should see a screen of help information relating to Rails. If you still see the message, “’rails’ is not recognized as an internal or external command, operable program or batch file.” then Rails is not installed. You must have a workable installation of Rails in order to develop Rails applications with Ruby In Steel.