RVM 警告!PATH 未正确设置 [英] RVM Warning! PATH is not properly set up

查看:39
本文介绍了RVM 警告!PATH 未正确设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在我的 mac 上安装了 rvm,但是我在全局命令中收到了这个警告

<块引用>

警告!PATH 设置不正确,'/usr/local/rvm/gems/ruby-1.9.3-p194/bin' 不是首先出现的,这通常是由 shell 初始化文件引起的 - 检查它们是否有 'PATH=...' 条目,它也可能有助于将 RVM 重新添加到您的点文件:'rvm get stable --auto-dotfiles',在此 shell 会话运行中临时修复:'rvm use ruby​​-1.9.3-p194'.

我的 $PATHS 确认警告:

$echo :$PATH:

<块引用>

/usr/local/rvm/bin:/usr/local/heroku/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:

按照建议,我首先尝试 rvm get stable --auto-dotfiles 无济于事,然后我检查了我的 shell 初始化文件.我的/.bash_profile:

导出路径=/usr/local/bin:/usr/local/sbin:$PATH导出 PATH=/usr/local/share/python:$PATHPATH=$PATH:$HOME/bin:/opt

我的/Users/User/.bash_profile 似乎是罪魁祸首:

export PS1=[w]$"别名 ll='ls -laGH'别名 .='echo $PWD'### 由 Heroku 工具带添加导出 PATH="/usr/local/heroku/bin:$PATH";# rvmPATH=/usr/local/rvm/bin:$PATH[[ -s "$HOME/.rvm/scripts/rvm";]] &&源$HOME/.rvm/scripts/rvm"# 将 RVM 加载到 shell 会话中*作为函数*

原因是如果我删除 Heroku Toolbelt 和 rvm 路径(这是其他堆栈溢出问题建议的答案),/usr/local/rvm/gems/ruby-1.9.3-p194/bin 会排在第一位,问题就解决了.但是,我不知道如何处理 Heroku Toolbelt.另外,PATH=/usr/local/rvm/bin:$PATH 无论如何都不应该将 rvm 放在首位吗?

我一定错过了一些琐碎的解决方案.

补充说明:$rvm --debug get head 除了上面发布的警告之外,不会产生任何安装说明.

更新:调用 rvm system 可修复问题,但仅限于当前 shell 会话.$echo $PATH 现在产生:

:/usr/local/heroku/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/rvm/bin:

什么是永久修复?

解决方案

我的rvm 1.25.26也有同样的问题.

解决方案:

我修改了~/.bashrc如下:

## rvmPATH="$GEM_HOME/bin:$HOME/.rvm/bin:$PATH" # 将 RVM 添加到 PATH 以进行脚本编写[ -s ${HOME}/.rvm/scripts/rvm ] &&源 ${HOME}/.rvm/scripts/rvm

导致:

在 __rvm_path_match_gem_home_check() 函数中触发警告$HOME/.rvm/scripts/functions/cli.

如果 $PATH 的开头不是从 $GEM_HOME/bin 开始,则会显示警告消息.

__rvm_path_match_gem_home_check(){((${rvm_silence_path_mismatch_check_flag:-0} == 0)) ||返回 0[[ -n "${GEM_HOME:-}" ]] ||返回 0案例$PATH:"在($GEM_HOME/bin:*) 真;;# 这里一切都好(*:$GEM_HOME/bin:*)__rvm_path_match_gem_home_check_warning 不在第一位";;(*)__rvm_path_match_gem_home_check_warning 不可用";;经社理事会}

I just installed rvm on my mac, but I receive this warning on global commands

Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-1.9.3-p194/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-1.9.3-p194'.

My $PATHS confirms the warning:

$echo :$PATH:

/usr/local/rvm/bin:/usr/local/heroku/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:

As suggested, I first tried rvm get stable --auto-dotfiles to no avail, then I checked my shell initializations files. My /.bash_profile:

export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH=/usr/local/share/python:$PATH
PATH=$PATH:$HOME/bin:/opt

My /Users/User/.bash_profile seems to be the culprit:

export PS1="[w]$"
alias ll='ls -laGH'
alias .='echo $PWD'

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

# rvm
PATH=/usr/local/rvm/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

The reason is if I remove Heroku Toolbelt and the rvm paths (which were answers suggested by other stack overflow questions), /usr/local/rvm/gems/ruby-1.9.3-p194/bin would be in first place and the problem is resolved. However, I don't know what to do with the Heroku Toolbelt. Additionally, shouldn't PATH=/usr/local/rvm/bin:$PATH place rvm first anyways?

I must be missing some trivial solution.

Additional notes: $rvm --debug get head produces no installation notes regarding this except for the warning posted above.

Update: calling rvm system fixes the problem, but only in the current shell session. $echo $PATH now produces:

:/usr/local/heroku/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/rvm/bin:

What is a permanent fix?

解决方案

I have the same problem with rvm 1.25.26.

solution:

I've modified ~/.bashrc as follows:

## rvm
PATH="$GEM_HOME/bin:$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting
[ -s ${HOME}/.rvm/scripts/rvm ] && source ${HOME}/.rvm/scripts/rvm

causing:

Warning is fired at __rvm_path_match_gem_home_check() function in $HOME/.rvm/scripts/functions/cli.

If the beginning of $PATH does not start from $GEM_HOME/bin, a warning message is displayed.

__rvm_path_match_gem_home_check()
{
  (( ${rvm_silence_path_mismatch_check_flag:-0} == 0 )) || return 0
  [[ -n "${GEM_HOME:-}" ]] || return 0
  case "$PATH:" in
    ($GEM_HOME/bin:*) true ;; # all fine here
    (*:$GEM_HOME/bin:*)
      __rvm_path_match_gem_home_check_warning "is not at first place"
      ;;
    (*)
      __rvm_path_match_gem_home_check_warning "is not available"
      ;;
  esac
}

这篇关于RVM 警告!PATH 未正确设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆