使用 rvm 更新 ruby​​ 版本后收到警告消息“路径设置为 RVM”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27784961/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:02:07  来源:igfitidea点击:

Received Warning message "Path set to RVM" after updating ruby version using rvm

ruby-on-railsrvmoh-my-zsh

提问by echo

Recently I tried to update my ruby version due to a warning message (see below).

最近,由于警告消息(见下文),我尝试更新我的 ruby​​ 版本。

Now I get the following warning message when I start my iterm2:

现在,当我启动 iterm2 时收到以下警告消息:

Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see:
    https://github.com/wayneeseguin/rvm/issues/3212

Does anyone know how to resolve this warning?It hasn't really impacted my work but it is a little unsettling.

有谁知道如何解决这个警告?它并没有真正影响我的工作,但它有点令人不安。

for your information:
1. I believed I ran rvm get stableto get the latest ruby version.
2. this is the warning message I was initially trying to resolve but it has not been resolved either:

供您参考:
1. 我相信我是rvm get stable为了获得最新的 ruby​​ 版本。
2. 这是我最初试图解决但也没有解决的警告消息:

warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.5-compliant syntax, but you are running 2.1.2.

I am using 1. Mac OS X2. iterm2and 3.oh-my-zshshell

我正在使用 1. Mac OS X2.iterm2和 3.oh-my-zsh外壳

回答by ymin

I had same issue with oh-my-zsh While installing rvm with option --rails, there was this warning:

我对 oh-my-zsh 有同样的问题在使用选项 --rails 安装 rvm 时,出现了这个警告:

This solution works for me: Open .zshrcfile, and find PATH line

此解决方案适用于我:打开.zshrc文件,并找到 PATH 行

change

改变

export PATH=/path/to/something

export PATH=/path/to/something

into

进入

export PATH="$PATH:/path/to/something"

export PATH="$PATH:/path/to/something"

save it and do source ~/.zshrc, Then it worked.

保存并执行source ~/.zshrc,然后它起作用了。

回答by robinwen

If you find a line after User configurationin the ~/.zshrc file like this:

如果您User configuration在 ~/.zshrc 文件中找到如下一行:

#export PATH="/Users/robinwen/.rvm/gems/ruby-1.9.3-p551@robin/bin:/Users/robinwen/.rvm/gems/ruby-1.9.3-p551@global/bin:/Users/robinwen/.rvm/rubies/ruby-1.9.3-p551/bin:/Users/robinwen/.rvm/bin:/usr/local/git/bin:/sw/bin:/usr/local/bin:/usr/local:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/"

#export PATH="/Users/robinwen/.rvm/gems/ruby-1.9.3-p551@robin/bin:/Users/robinwen/.rvm/gems/ruby-1.9.3-p551@global/bin:/用户/robinwen/.rvm/rubies/ruby-1.9.3-p551/bin:/Users/robinwen/.rvm/bin:/usr/local/git/bin:/sw/bin:/usr/local/bin: /usr/local:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin /"

You should comment this line, and add following line:

您应该注释此行,并添加以下行:

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

export PATH=$PATH:$HOME/.rvm/bin # 将 RVM 添加到 PATH 以进行脚本编写

Good luck!

祝你好运!

回答by maxhungry

Adding to @ymin's solution. For me, who ran rvm listand did not have a current ruby selected, needs to manually select a ruby ie. rvm use ruby-2.1.x, then fix zshrc path and run rvm get stable.

添加到@ymin 的解决方案中。对于我,谁跑了rvm list,没有选择当前的红宝石,需要手动选择一个红宝石,即。rvm use ruby-2.1.x,然后修复 zshrc 路径并运行rvm get stable.

回答by leoj

As of Dec 19, 2014, sudo rvmshows these PATH warnings when the root user's default shell is not supported.

截至 2014 年 12 月 19 日,sudo rvm不支持root 用户的默认 shell 时显示这些 PATH 警告。

In this case of running sudo rvmthe solution is to use rvmsudo.

在这种运行sudo rvm的情况下,解决方案是使用rvmsudo.

回答by u5729830

I have the same question

我也有同样的问题

my solution method is add

我的解决方法是添加

source /etc/profile.d/rvm.sh

in .zshrc

在.zshrc

source .zshrc is ok

源 .zshrc 没问题

good luck for you!

祝你好运!

回答by JayKan

After adding [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" to the top of ~/.zshrc rather than the bottom I can confirm this has solved the issue for me.

将 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 添加到 ~/.zshrc 的顶部而不是底部后,我可以确认这已经解决了我的问题。

回答by idsbllp

same issue here, add code below into ~/.zshrcworks for me.

同样的问题在这里,将下面的代码添加到~/.zshrc我的作品中。

export GEM_HOME="$GEM_HOME:$HOME/.rvm/bin"
export GEM_PATH="$GEM_PATH:$HOME/.rvm/bin"

And then source ~/.zshrc.

然后source ~/.zshrc