使用RailsInstaller后,bundle install失败

时间:2016-05-01 18:07:23

标签: ruby-on-rails ruby batch-file

我使用RailsInstaller安装了Ruby。安装位置为C:\RailsInstaller。当我使用RubyMine创建一个新项目时,我无法启动Web服务,因为我甚至无法运行bundle install

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

我的PATH中有以下与Rails有关的内容:

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

我在网上做了一些研究,很多人都声称rails.bat是不正确的。以下是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" %*

我试图改变这一点,没有运气:

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

我试图手动初始化DevKit并获得以下内容:

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'

进入C:\RailsInstaller\DevKit\config.yml并将- C:/Ruby22更改为- C:/RailsInstaller/Ruby2.2.0,然后重新运行:

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'

我需要做什么/改变,以便我可以使用我的本地环境进行RoR开发。

3 个答案:

答案 0 :(得分:2)

尝试手动初始化DevKit:

ruby dk.rb init
ruby dk.rb install

在运行dk.rb install之前,确保config.yml(在DevKit内)指向正确的位置:

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

编辑:正如@Cameron指出评论,修改ruby dk.rb install -f后可能需要运行config.yml

我遇到了同样的问题,在我的情况下,config.yml指向RailsInstaller安装Ruby以外的其他地方。

答案 1 :(得分:0)

您需要在Windows上为PATH添加3个文件夹:

  1. C:\ RailsInstaller \ GIT中\ CMD;
  2. C:\ RailsInstaller \ Ruby1.9.3 \ BIN;
  3. C:\ RailsInstaller \ Ruby1.9.3 \的devkit \ BIN;

答案 2 :(得分:0)

我遇到与你的情况相同的问题,我解决如下:

打开C:\RailsInstaller\Ruby2.2.0\bin\bundle.bat

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

转到您的工作区并%>bundle install

没关系!