简体   繁体   English

使用RailsInstaller后捆绑安装失败

[英]bundle install fails after using RailsInstaller

I have installed Ruby using RailsInstaller. 我已经使用RailsInstaller安装了Ruby。 The location of the install is C:\\RailsInstaller . 安装位置为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 : 当我使用RubyMine创建一个新项目时,由于无法运行bundle install因此无法启动Web服务:

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 : 我的PATH包含与Rails有关的以下内容:

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. 我已经在网上进行了一些研究,许多人声称这是rails.bat是不正确的。 Here is the original file at C:\\RailsInstaller\\Ruby2.2.0\\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" %*

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: 我试图手动初始化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'

Going into C:\\RailsInstaller\\DevKit\\config.yml and changing - C:/Ruby22 to - C:/RailsInstaller/Ruby2.2.0 and then rerunning: 进入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'

What do I need to do / change so that I can use my local environment for RoR development. 我需要做什么/更改,以便可以将本地环境用于RoR开发。

Try to manually initialize DevKit: 尝试手动初始化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 : 并在运行dk.rb install之前确保config.yml(在DevKit中)指向正确的位置:

---
- 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 编辑:正如@Cameron指出的那样,在修改config.yml后可能需要运行ruby dk.rb install -f

I had the same problem and, in my case, the config.yml was pointing to somewhere else other then Ruby installed by RailsInstaller. 我遇到了同样的问题,就我而言, config.yml指向的是RailsInstaller安装的Ruby以外的其他地方。

You need to add 3 folders to your PATH on Windows: 您需要在Windows的PATH添加3个文件夹:

  1. C:\\RailsInstaller\\Git\\cmd; C:\\ RailsInstaller \\ Git \\ cmd;
  2. C:\\RailsInstaller\\Ruby1.9.3\\bin; C:\\ RailsInstaller \\ Ruby1.9.3 \\ bin;
  3. C:\\RailsInstaller\\Ruby1.9.3\\DevKit\\bin; 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 , 打开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" "C:\\Users\\emachnic\\GitRepos\\railsinstaller-windows\\stage\\Ruby2.2.0\\bin\\ruby.exe"更改为@"%~dp0ruby.exe"

Go to your workspace and %>bundle install 转到您的工作区并%>bundle install

It would be ok! 没关系!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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