简体   繁体   中英

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.

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.

You need to add 3 folders to your PATH on Windows:

  1. C:\\RailsInstaller\\Git\\cmd;
  2. C:\\RailsInstaller\\Ruby1.9.3\\bin;
  3. C:\\RailsInstaller\\Ruby1.9.3\\DevKit\\bin;

I meet the same issue as your case, I solve it as below:

Open C:\\RailsInstaller\\Ruby2.2.0\\bin\\bundle.bat ,

Change : "C:\\Users\\emachnic\\GitRepos\\railsinstaller-windows\\stage\\Ruby2.2.0\\bin\\ruby.exe" to @"%~dp0ruby.exe"

Go to your workspace and %>bundle install

It would be ok!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM