启动终端时出现错误信息。 [zsh的]

时间:2016-02-21 02:45:37

标签: zsh rbenv

当我启动终端时,我收到此消息:

/usr/lib/rbenv/libexec/../completions/rbenv.bash:16: command not found: complete
~ % 

其他一切似乎都很正常。我运行tmux时没有收到消息,只有当我启动一个新的终端时。

这是我的〜/ .zshrc文件:

# load custom executable functions
for function in ~/.zsh/functions/*; do
  source $function
done

# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
  _dir="$1"
  if [ -d "$_dir" ]; then
    if [ -d "$_dir/pre" ]; then
      for config in "$_dir"/pre/**/*(N-.); do
        . $config
      done
    fi

    for config in "$_dir"/**/*(N-.); do
      case "$config" in
        "$_dir"/pre/*)
          :
          ;;
        "$_dir"/post/*)
          :
          ;;
        *)
          if [ -f $config ]; then
            . $config
          fi
          ;;
      esac
    done

    if [ -d "$_dir/post" ]; then
      for config in "$_dir"/post/**/*(N-.); do
        . $config
      done
    fi
  fi
}
_load_settings "$HOME/.zsh/configs"

# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
alias sz='source ~/.zshrc'

# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local

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

# rbenv config
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"

造成这种情况的原因是什么?我怎么能摆脱它?我可以成功调用我的Ruby版本,并且已经运行rbenv initrbenv rehash

rbenv version
2.3.0 (set by /home/drempel/.rbenv/version)

ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

1 个答案:

答案 0 :(得分:0)

github page for rbenv上发布了有关rbenv init脚本导致zsh用户问题的问题。这在以后的版本中得到修复。答案是将eval "$(rbenv init -)"更改为eval "$(rbenv init - zsh)"。我做了这个,但它没有清除错误信息。在阅读了我的〜/ .zshrc文件后,我意识到它正在从〜/ .zsh / configs加载文件。

在〜/ .zsh / configs / post / path.zsh中有另一个rbenv init配置:

# ensure dotfiles bin directory is loaded first
PATH="$HOME/.bin:/usr/local/sbin:$PATH"

# load rbenv if available
if command -v rbenv >/dev/null; then
  eval "$(rbenv init - --no-rehash)"
fi

# mkdir .git/safe in the root of repositories you trust
PATH=".git/safe/../../bin:$PATH"

export -U PATH

我更改了行eval "$(rbenv init - --no-rehash)"以反映eval "$(rbenv init - zsh --no-rehash)",这解决了我的问题。

相关问题