Cameron Aziz Cameron Aziz - 7 months ago 60
Ruby Question

bundle install fails after using RailsInstaller

I have installed Ruby using RailsInstaller. The location of the install is

C:\RailsInstaller
. When I create a new project with RubyMine I can not start the web service as I can't even run
bundle install
:

C:\Users\Cameron\Documents\Development>bundle install
The system cannot find the path specified.


I have the following that pertains to Rails in my
PATH
:

C:\RailsInstaller\Git\cmd
C:\RailsInstaller\Ruby2.2.0\bin
C:\RailsInstaller\Ruby2.2.0\DevKit\bin


I have done some research online and a lot of people are claiming that it is
rails.bat
is incorrect. Here is the original file at
C:\RailsInstaller\Ruby2.2.0\bin\rails.bat
:

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


I have tried to change to this, with no luck:

@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 have attempted to manually initialize DevKit and got the following:

C:\RailsInstaller\DevKit>ruby dk.rb init
[INFO] found RubyInstaller v2.2.1 at C:/Ruby22

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\RailsInstaller\DevKit>ruby dk.rb install
[ERROR] Skipping invalid directory 'C:/Ruby22'


Going into
C:\RailsInstaller\DevKit\config.yml
and changing
- C:/Ruby22
to
- C:/RailsInstaller/Ruby2.2.0
and then rerunning:

C:\RailsInstaller\DevKit>ruby dk.rb install
[INFO] Skipping existing gem override for 'C:/RailsInstaller/Ruby2.2.0'
[WARN] Skipping existing DevKit helper library for 'C:/RailsInstaller/Ruby2.2.0'


What do I need to do / change so that I can use my local environment for RoR development.

Answer

Try to manually initialize DevKit:

ruby dk.rb init
ruby dk.rb install

And make sure that the config.yml (inside DevKit) points to the right place before running dk.rb install:

---
- C:\RailsInstaller\Ruby<version number>

EDITED: As @Cameron pointed on comment, it might be necessary to run ruby dk.rb install -f after modifying config.yml

I had the same problem and, in my case, the config.yml was pointing to somewhere else other then Ruby installed by RailsInstaller.