【问题标题】:RVM with OhMyZSH warnings with PATH not set properly带有 OhMyZSH 警告且 PATH 未正确设置的 RVM
【发布时间】:2016-08-19 15:19:03
【问题描述】:

我刚刚安装了 RVM 的新副本,在运行 rvm gemset list 时,我不断收到此错误:

$ rvm gemset list
Warning! PATH is not properly set up, '/Users/dmonsewicz/.rvm/gems/ruby-2.3.1/bin' is not available,
         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'.

gemsets for ruby-2.3.1 (found in /Users/dmonsewicz/.rvm/gems/ruby-2.3.1)
=> (default)
   *

这是我的.zshrc 文件:

export HOME=/Users/dmonsewicz

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="ys"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment following line if you want to  shown in the command execution time stamp
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
# yyyy-mm-dd
# HIST_STAMPS="mm/dd/yyyy"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"

# # Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

PATH=$PATH:/usr/local/bin:/usr/local/sbin:$PATH
export LOCALEMMA_EMMA_BASE_DIR=/Users/dmonsewicz/dev/emma/
export LOCALEMMA_EMMADMIN_BASE_DIR=/Users/dmonsewicz/dev/emmadmin/
export LOCALEMMA_AUDIENCE_BASE_DIR=/Users/dmonsewicz/dev/audience/
export WORKON_HOME=$HOME/.virtualenvs

export PERL5LIB=$HOME/perl5/lib/perl5;
PATH=$HOME/perl5/bin:$PATH

PERL_MB_OPT="--install_base \"/Users/dmonsewicz/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/Users/dmonsewicz/perl5"; export PERL_MM_OPT;

ORIGINAL_PATH=$PATH

function build_path {
    PATH=$(node bin):$ORIGINAL_PATH
}

PROMPT_COMMAND=build_path

export NVM_DIR="/Users/dmonsewicz/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

# LOCALEMMA lemma zsh completion
fpath=(/Users/dmonsewicz/dev/LocalEmma/bin $fpath)
autoload -U compinit
compinit

eval $(dinghy shellinit)
export RAILS_ENV="development"
export DB_NAME="traverse_core_development"
export DB_USER="dmonsewicz"
export DB_PASSWORD=""

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

export PATH

source /usr/local/bin/virtualenvwrapper.sh

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

【问题讨论】:

  • 当你执行echo $PATH时,当前shell会发生什么?
  • @Anthony $ echo $PATH /Users/dmonsewicz/perl5/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/dmonsewicz/.rvm/bin

标签: ruby oh-my-zsh zshrc


【解决方案1】:

使用您的终端作为登录 shell(如果您使用的是 zsh /usr/bin/zsh --login)并尝试将以下行添加到您的 ~/.zshrc 文件并获取它 source ~/.zshrc

export PATH="$PATH:$HOME/.rvm/bin" 
source ~/.rvm/scripts/rvm

然后使用像rvm use 2.3.0 这样的rvm 命令。登录 shell 允许您的 rvm 脚本更改系统的配置文件。例如将 rvm ruby​​ 路径附加到您的 $PATH 变量

【讨论】:

  • 在运行 rvm 命令之前运行 /usr/bin/zsh --login@D-side
  • 不,错误信息会有所不同。而且,实际上,我不是 OP,我只是碰巧遇到了这些问题 :)
  • 在您运行rvm use 2.3.1 之后,您的echo $PATH 是否在输出中吐出了rvm ruby​​ 路径?
  • 我猜这必须在 question 下的评论中提出。
猜你喜欢
  • 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
相关资源
最近更新 更多