否認我創建了一個項目的具體.rvmrc
文件,其中包含一個自定義寶石(使用命令rvm --rvmrc --create [email protected]
):RVM:權限而從.rvmrc文件加載寶石全系統的安裝
# excerpt of .rvmrc...
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"
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
then
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
fi
else
# If the environment file has not yet been created, use the RVM CLI to select.
if ! rvm --create "$environment_id"
then
echo "Failed to create RVM environment '${environment_id}'."
return 1
fi
fi
這對本地工作我的Mac,使用單用戶RVM。我們還使用Vagrant,在我們的Vagrant盒上安裝了系統範圍的RVM。然而,當我們cd
到項目目錄並接受.rvmrc
文件,它的結果在下面留言(是的,有很多重複的錯誤消息):
mkdir: cannot create directory `/usr/local/rvm/gems/[email protected]': Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/ruby[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
-bash: /usr/local/rvm/environments/[email protected]: Permission denied
mkdir: cannot create directory `/usr/local/rvm/wrappers/[email protected]': Permission denied
試圖創建寶石手工提到相同錯誤,但也提到它是成功的:
$ rvm use 1.9.2
Using /usr/local/rvm/gems/ruby-1.9.2-p318
$ rvm gemset create registration
mkdir: cannot create directory `/usr/local/rvm/gems/[email protected]': Permission denied
'registration' gemset created (/usr/local/rvm/gems/[email protected]).
我有東西配置不正確嗎?如何解決此問題,以便我可以使用.rvmrc
文件中的自定義gemset?
我敢肯定, 'sudo rvm ...'會起作用,但這不是正確的解決方案。當我將'cd'放入目錄時,'.rvmrc'文件應該自動加載並創建gemset而不需要sudo。這裏有一個更大的問題。 – Andrew 2012-03-15 19:50:24