Rails - The system cannot find the path specified
This is due to a bug in RailsInstaller, where two files have the location of ruby.exe
hard-coded to work only on the RailsInstaller dev's machine. In C:\RailsInstaller\Ruby2.2.0\bin\rails.bat
(this is the default install folder, you might have rails.bat
somewhere else if you picked a different install folder) you'll find these two lines:
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %*
The emachnic user is the RailsInstaller developer. As a workaround, you can change these folders to the ones on your computer. For the default install folder, you'd change these to:
@"C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "C:\RailsInstaller\Ruby2.2.0\bin\rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
@"C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %*
You will have to repeat this change for two similar lines in C:\RailsInstaller\Ruby2.2.0\bin\bundle.bat
as well.
Run rails -v
to verify that rails is now working.
You can follow this issue on their git repo here: https://github.com/railsinstaller/railsinstaller-windows/issues/70
The solution is specified on github issues of railsinstaller - https://github.com/railsinstaller/railsinstaller-windows/issues/73
Go into C:\RailsInstaller\Ruby2.2.0. In some of the .bat files, you'll find the following:
@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/tilt" %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" %*
Delete that and paste in the text below:
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*
I opened all the .bat
files under C:\RailsInstaller\Ruby2.2.0\bin in Sublime Text, and replaced with Ctrl+Shift+F
,
this@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe"
with this@"%~dp0ruby.exe"
across all files that had a match.
Took only a couple of seconds. This might help someone who stumbles across it after me and is daunted by the idea of performing a find and replace over multiple files.