Rails not in path but ruby is?

672 views
Skip to first unread message

Nolan Johnson

unread,
Feb 14, 2016, 11:20:04 PM2/14/16
to RailsInstaller
Everything seemed to work fine, but when I type rails in the command line I get "The system cannot find the path specified." I've checked my environment variables and the directory is in fact there and when I type ruby -v I receive the version number as I should. Ruby and rails are both in the same directory as the path specified in my environment variables. Can someone help me figure out how to resolve this?

Thanks!

Fred Olive

unread,
Feb 16, 2016, 7:27:10 AM2/16/16
to RailsInstaller
Hi everyone,

Same issue here:
  • Extracted RailsInstaller, everything looks good
  • ruby -v works, git -- version as well
  • rails -v (or any Rails command) gives me a "The system cannot find the path specified."
  • my user path is: "C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.2.0\bin;C:\Phantomjs\bin"
  • rails.bat is present in the C:\RailsInstaller\Ruby2.2.0\bin folder
  • I tried to uninstall and reinstall Rails (gem uninstall rails / gem install rails) and the whole RailsInstaller but same error message
Any help very welcomed.

Cheers,
Fred

System: Windows 10, RailsInstaller 3.2.0

kristo...@objective.se

unread,
Feb 16, 2016, 7:35:06 AM2/16/16
to RailsInstaller
Ive found that the .bat files in the RailsInstaller\Ruby2.2.0\bin file includes a repo path to one "emachnic", This makes the path not able to be found on the users computer.
By changing the path on the last line to be the correct path to the ruby.exe I made it work for me. But this looks like a bug.

Fix:

Open C:\RailsInstaller\Ruby2.2.0\bin\rails.bat
Change the content to something similar to:

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/sass" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %*

Save and it should work

Fred Olive

unread,
Feb 16, 2016, 8:06:01 AM2/16/16
to RailsInstaller
Thanks! Indeed the rails.bat file is bugged.
I guess you meant changing the path to remove "emachnic" and have something like:

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*

It's what I've done and it works :-)

Thanks again.
Fred

kristo...@objective.se

unread,
Feb 16, 2016, 9:24:13 AM2/16/16
to RailsInstaller
Yes that should work. If you have the path to the "bin" folder in the PATH environment variable.
This is a recurring problem in more files than rails.bat. Haven't checked all of them but sass.bat has the same.

Brian Clarke

unread,
Feb 23, 2016, 3:33:26 PM2/23/16
to RailsInstaller
Fred's fix worked for me also.  The .bat file is indeed broken.

caspe...@gmail.com

unread,
Mar 1, 2016, 10:19:01 AM3/1/16
to RailsInstaller
List of .bat files with this bug:
bundle.bat
bundler.bat
erubis.bat
nokogiri.bat
rackup.bat
sass.bat
sass-convert.bat
scss.bat
sprockets.bat
sqlite3_ruby.bat
thor.bat
tilt.bat

Asier Rodriguez

unread,
Mar 20, 2016, 7:09:19 PM3/20/16
to RailsInstaller
This list and rails.bat 
The fix works for me too, thanks!
Message has been deleted

Henry Harding McCall

unread,
Apr 1, 2016, 10:35:16 AM4/1/16
to RailsInstaller
hello guys - I'm extremely new to this, and I've figured out how to fix all these files (using Fred's method). but can someone explain what exactly I'm doing? Or point me to a resource that can?

Why does Fred's work without specifying the whole path? I'm not even sure if I understand what I'm asking XX.

I am able to edit the .bat files and then check the versions of everything, where before the path could not be found.

Surya Avantsa

unread,
Apr 1, 2016, 7:31:50 PM4/1/16
to railsin...@googlegroups.com
Fred Olive's fix worked for me too. This is how it is supposed to be. Machnic should have fixed that batch file like Fed Olive did in the first place, before releasing it to the public on a world wide website. I wonder why he/she didn't. That would improve the credibility of the railsinstaller.org website and its contents.


Thank You,

Surya Avantsa


--
You received this message because you are subscribed to the Google Groups "RailsInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to railsinstalle...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages