I have followed this tutorial for installing ruby on rails on windows. (the steps are explained in the video in the middle of the page)
If I run the rails command in a classic windows shell (windows + r > cmd > enter), it works fine. However, I would like to be able to invoke it in a cygwin shell. But if I do, for example:
$> rails s # in cygwin
I have the following error:
C:\RailsInstaller\Ruby1.9.3\bin\ruby.exe: No such file or directory -- /cygdrive/c/RailsInstaller/Ruby1.9.3/bin/rails (LoadError)
I've looked into this folder:C:\RailsInstaller\Ruby1.9.3\bin\, and there is indeed no rails.exe, but only a rails and rails.bat file.
rails.bat looks like this:
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:/Projects/railsinstaller/stage/Ruby1.9.3/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*
I only know that cygwin looks for .exe files (for example, if you type cp, is it going to execute the cp.exe executable). I don't know how .bat files works.
So do you know how I can make cygwin able to invoke the rails command ?
As you've stated, the rails on windows is a ".bat" file. Just use the ".bat" extension in every command. It worked for me.
Try and see: "rails.bat -v" (in Cygwin)
I faced the same issue in cygwin but the "rails" command was working fine in windows cmd prompt. As a turn around
Invoke the following command in cygwin,
alias rails='path_to_ruby_installed_directory/bin/rails.bat'
In your case,
alias rails ='C:/Projects/railsinstaller/stage/Ruby1.9.3/bin/rails.bat'
To make the alias permanent, Edit the .bashrc file in CYGWIN home directory and add the above alias in it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With