0

I installed Rails from http://railsinstaller.org/en on my Windows 7 desktop and the installation went fine. However, after installation when I do:

C:\Sites>rails --version
The system cannot find the path specified.

C:\Sites>ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]

C:\Sites>gem -v
2.4.5.1
Nital
  • 5,784
  • 26
  • 103
  • 195
  • Possible duplicate of [The system cannot find the path specified when starting Ruby and Rails command prompt](http://stackoverflow.com/questions/6637922/the-system-cannot-find-the-path-specified-when-starting-ruby-and-rails-command-p) – Vucko Feb 18 '16 at 14:57
  • Followed the provided links and tried adding Git/bin directory to Windows system path but it did not resolve the problem. – Nital Feb 18 '16 at 15:33

2 Answers2

3

After much digging around I found errors in a few of the *.bat (nokogiri, scss,...) files located in C:\path\to\RailsInstaller\Ruby2.2.0\bin.

This was the content of rails.bat:

@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/rails" %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" %*`

After removing the hardcoded paths C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\, the rails command reports the correct version:

C:\path\to\RailsInstaller3.2\Ruby2.2.0\bin>rails -v
Rails 4.2.5.1
jlbenc
  • 424
  • 4
  • 6
0

Found the problem. It looks like the distributable (railsinstaller-3.2.0.exe which uses Ruby 2.2) provided on rails installer site (http://railsinstaller.org/en) is having some problem. When I picked the older version (railsinstaller-3.1.1.exe which uses Ruby 2.1) it was able to pick the rails version without any problem.

C:\>rails --version
Rails 4.2.5.1

C:\>ruby --version
ruby 2.1.8p440 (2015-12-16 revision 53160) [i386-mingw32]

Please note that the ruby version is downgraded from 2.2 to 2.1 here.

Nital
  • 5,784
  • 26
  • 103
  • 195