社内の別の人が開発した Rails アプリを Github から複製しました。
アプリのディレクトリに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 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
と、「you are using '.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バージョンは1.22.18です。
何が起こっていますか?私はrvmまたは.rvmrcファイルをまったく理解していません.私のマシン上の他のアプリの他のすべてのRailsは完全に正常に動作します. このレールアプリを機能させるにはどうすればよいですか?
FWIW、.rvmrc
GH からレポを最初に複製したときのファイルは次のようになります。(簡潔にするためにコメントは削除されています):
#!/usr/bin/env zsh
environment_id="ruby-1.9.3-p448@loopAdoop"
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
ファイルは削除され、2 つの新しいファイルが生成されます:.ruby-gemset
アプリの名前.ruby-version
だけを含む と、テキスト " ruby-1.9.3-p448
"だけを含む です。