2013-10-09 31 views
0

我克隆了一個由我的公司內另一個人從Github開發的Rails應用程序。.rvrmc /從github克隆新Rails時「找不到railties」

當我cd到應用程序的目錄,我得到在終端這個消息:

You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers, 
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version' 
or ignore this warning with 'rvm rvmrc warning ignore /Users/george/evil-genius/Loopadoop/.rvmrc', 
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2, 
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'. 

然後,當我嘗試運行任何rails命令如rails server我得到這個錯誤:

/Users/george/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [rvm-1.11.3.8] (Gem::LoadError) 
    from /Users/george/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' 
    from /Users/george/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems.rb:1231:in `gem' 
    from /Users/george/.rvm/rubies/ruby-1.9.3-p448/bin/rails:22:in `<main>' 

如果我跑rvm rvmrc to .ruby-version,我不再收到「您正在使用‘.rvmrc’......」的警告,但嘗試時我仍然得到關於railties相同的錯誤消息運行rails命令。

rvm list顯示了安裝這些版本的Ruby:

rvm rubies 

* ruby-1.9.3-p385 [ x86_64 ] 
=> ruby-1.9.3-p448 [ x86_64 ] 
    ruby-2.0.0-p195 [ x86_64 ] 
    ruby-2.0.0-p247 [ x86_64 ] 

# => - current 
# =* - current && default 
# * - default 

我的RVM的版本是18年1月22日。

發生了什麼事?我完全不瞭解rvm或.rvmrc文件,並且我機器上其他應用程序中的所有其他Rails內容都可以正常工作。 如何讓這個rails應用程序工作?

FWIW,這是.rvmrc文件當我第一次克隆GH的回購時的外觀。 (爲簡潔,刪除評論):

#!/usr/bin/env zsh 

environment_id="[email protected]" 

if [[ -d "${rvm_path:-$HOME/.rvm}/environments" 
    && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] 
then 
    \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" 
    for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"* 
    do 
    if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]] 
    then \. "${__hook}" || true 
    fi 
    done 
    unset __hook 
    if ((${rvm_use_flag:=1} >= 2)) # display only when forced 
    then 
    if [[ $- == *i* ]] # check for interactive shells 
    then printf "%b" "Using: \E[32m$GEM_HOME\E[0m 
" # show the user the ruby and gemset they are using in green 
    else printf "%b" "Using: $GEM_HOME 
" # don't use colors in non-interactive shells 
    fi 
    fi 
else 
    rvm --create "$environment_id" || { 
    echo "Failed to create RVM environment '${environment_id}'." 
    return 1 
    } 
fi 

後,我跑rvm rvmrc to .ruby-version,則.rvmrc文件被刪除,和兩個新的文件生成:.ruby-gemset,其中只包含我的應用程序的名稱,.ruby-version,剛剛包含文本 「ruby-1.9.3-p448

回答

0

你需要運行:

gem install bundler && 
bundle install 

它將安裝這個項目所需

可以讓它自動上cd與寶石:

echo rvm_autoinstall_bundler_flag=1 >> ~/.rvmrc 
+0

不起作用:'/Users/george/.rvm/rubies/ruby-1.9 .3-p448/lib/ruby​​/1.9.1/ruby​​gems/dependency.rb:247:in \'to_specs':無法在[rvm-1.11.3.8](Gem :: LoadError)中找到bundler(> = 0) '。 我的Gemfile中的所有寶石都完全安裝在我的機器上,因爲我一直在其他項目中使用它們。 – GMA

+0

已更新,它們是否安裝在gemset中的同一個ruby中? – mpapis