【问题标题】:RVM: Warning! PATH is not properly set upRVM:警告! PATH 未正确设置
【发布时间】:2018-02-17 10:19:24
【问题描述】:

我在运行 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 问题。我试图为我的私人 bin 和 rvm 更改 ~/.profile$PATH 的顺序,如下所示:

# 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 的顺序,就像我为~/.profile 所做的那样。 但是我一直收到同样的警告。 如您所见,现在首先是 /home/asarluhi/.rvm/bin:

~ $ echo $PATH
/home/asarluhi/.rvm/bin:/home/asarluhi/.rvm/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/bin

【问题讨论】:

    标签: bash ubuntu-14.04 rvm


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-11
      • 1970-01-01
      • 1970-01-01
      • 2013-08-19
      • 2016-06-04
      • 2021-12-18
      • 2018-01-28
      相关资源
      最近更新 更多