安装的RVM,rvm命令不起作用

时间:2022-12-10 07:18:43

I just went through the RVM install.

我刚刚完成了RVM安装。

I did this command:

我做了这个命令:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

and everything ran fine. Then in my user home directory, in .bash_profile I added

一切都很好。然后在我的用户主目录中,在.bash_profile中我添加了

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

Then I started a new shell just to be sure. And then I tried

然后我开始一个新的shell只是为了确定。然后我试了一下

rvm 

and got the error that

并得到了错误

No command 'rvm' found

Any ideas why that might happen?

有什么想法可能会发生吗?

2 个解决方案

#1


5  

Did you see the "Troubleshooting your Install" section on this page.

您是否在此页面上看到“安装疑难解答”部分。

It mentions that you need to remove return from your .bashrc. I often forget to do this on a fresh ubuntu install.

它提到您需要从.bashrc中删除return。我经常忘记在新的ubuntu安装上执行此操作。

The example they give for ubuntu is to change this:

他们为ubuntu提供的例子是改变这个:

[ -z "$PS1" ] && return
# Some code here... e.g.
export HISTCONTROL=ignoreboth

to this:

对此:

if [[ -n "$PS1" ]]; then
  # Some code here... e.g.
  export HISTCONTROL=ignoreboth
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session

#2


8  

maybe it is because .bash_profile only runs on login, if you run a new shell it only executes .bashrc

也许是因为.bash_profile只在登录时运行,如果你运行一个新的shell它只执行.bashrc

You could test using

你可以测试一下

> bash -l

#1


5  

Did you see the "Troubleshooting your Install" section on this page.

您是否在此页面上看到“安装疑难解答”部分。

It mentions that you need to remove return from your .bashrc. I often forget to do this on a fresh ubuntu install.

它提到您需要从.bashrc中删除return。我经常忘记在新的ubuntu安装上执行此操作。

The example they give for ubuntu is to change this:

他们为ubuntu提供的例子是改变这个:

[ -z "$PS1" ] && return
# Some code here... e.g.
export HISTCONTROL=ignoreboth

to this:

对此:

if [[ -n "$PS1" ]]; then
  # Some code here... e.g.
  export HISTCONTROL=ignoreboth
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session

#2


8  

maybe it is because .bash_profile only runs on login, if you run a new shell it only executes .bashrc

也许是因为.bash_profile只在登录时运行,如果你运行一个新的shell它只执行.bashrc

You could test using

你可以测试一下

> bash -l