我刚安装了RVM,但是不能让它工作。我在我的.profile文件的末尾有这样的一行:

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

我试图运行源.profile和重新启动终端,但仍然,当我运行rvm使用1.9.2时,我得到:

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

我的系统是Ubuntu 11.10。


当前回答

我有同样的问题,我这样做在我的.bash_profile和它工作。 源”$ HOME / .rvm /脚本/区”。

其他回答

运行bash——login,然后运行rvm use 2.0.0。

您需要运行以下命令

$ source ~/.rvm/scripts/rvm

然后运行这个

$ type rvm | head -n 1

如果你得到

rvm is a function

问题解决了。

您还需要运行user$ rvm requirements以查看操作系统的依赖项要求

来源:https://rvm.io/rvm/install/

我忘记提到你需要把这个代码到你~/。Bashrc或~/。ZSHRC文件,您将不需要再次编写此代码。

我也遇到过这个问题。最后我在终端上执行了这行。

source ~/.rvm/scripts/rvm

问题解决了。因为这一行将使RVM实例成为特定时间的函数。

以上答案都是正确的。但当我面对同样的问题时,解决方案如下:

Update ZSH. (Tried to update directly din't work for some reason. So uninstalled and reinstalled updated version from here) Set default shell as zsh (i.e. if you prefer zsh) using sudo chsh -s $(which zsh) $USER Ensure that the following code is at the bottom of your .zshrc after you have installed the latest RVM probably using CURL from official RVM site [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" source ~/.profile MOST IMPORTANT POINT: Ensure that in your .zshrc file every export to PATH is appended with :$PATH. Which i believe was the root of my problems even after following the above steps. post this all my problems of RVM Not being a function went away. If it still does not work, give some error trace over here. After a few hours of struggle to solve this issue, i'm sure i must have seen all related errors.

希望能有所帮助。干杯!

您没有使用登录shell。

这里描述了启用登录标志的过程,也可以在这里找到登录shell的一些详细信息。

因此,您需要检查Gnome终端设置中的“作为登录shell运行”选项。设置标志后,需要打开新的终端。

有时需要将命令设置为/bin/bash——login。


对于远程连接,重要的是要理解运行交互式ssh会话和执行单个命令之间的区别。

当运行ssh服务器,然后与服务器交互工作时,默认情况下,您正在使用登录shell,这一切都很好,但对于ssh服务器“命令”,您不使用登录shell,它将被要求与ssh服务器“bash -lc”命令“”一起运行。

任何远程调用都可能存在与使用ssh执行单个命令相同的问题。