RVM:警告! PATH未正确设置

时间:2018-02-17 10:19:24

标签: bash ubuntu-14.04 rvm

我在运行rvm 1.27.0的Ubuntu 14.04 LTS机器上。
当我运行rvm list时,我收到以下警告:

Warning! PATH is not properly set up, '/home/asarluhi/.rvm/gems/ruby-2.3.1/bin' is not at first place,
     usually this is caused by shell initialization files - check them for 'PATH=...' entries,
     it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
     to fix temporarily in this shell session run: 'rvm use ruby-2.3.1'.

echo $PATH的输出是:

/home/asarluhi/bin:/home/asarluhi/.rvm/gems/ruby-2.3.1/bin:/home/asarluhi/.rvm/gems/ruby-2.3.1@global/bin:/home/asarluhi/.rvm/rubies/ruby-2.3.1/bin:/home/asarluhi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/usr/local/heroku/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/bin

如您所见,实际上/home/asarluhi/bin首先出现,/home/asarluhi/.rvm/bin重复7次。
我的~/.bashrc文件的最后两行是:

### Added by the Heroku Toolbelt
export PATH="$PATH:/usr/local/heroku/bin"

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting


我的~/.profile文件的最后一行是:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*


~/.bash_profile的内容是:

export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

要删除超出/home/asarluhi/.rvm/bin我可能会尝试删除~/.profile中的重复行。但是我不知道如何解决Warning! PATH is not properly set up问题。我尝试将$PATH的{​​{1}}的顺序更改为我的私人bin和rvm,如下所示:

~/.profile

我也像# set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$PATH:$HOME/bin" fi export PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting 那样改变了~/bashrc中$ PATH的顺序。 但是我一直收到同样的警告。 如你所见,现在首先有/home/asarluhi/.rvm/bin:

~/.profile

1 个答案:

答案 0 :(得分:0)

对配置dotfiles的唯一必要编辑是在$PATH中将$HOME/bin添加到~/.profile,如下所示:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$PATH:$HOME/bin"
fi