ruby RVM 不是一个函数,选择带有“rvm use ...”的红宝石将不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23963018/
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
RVM is not a function, selecting rubies with 'rvm use ...' will not work
提问by user3678471
List the ruby versions
列出 ruby 版本
console:~$ rvm list
rvm rubies
ruby-2.0.0-p481 [ i686 ]
# => - current
# =* - current && default
# * - default
Try to use a specific version of ruby
尝试使用特定版本的 ruby
console:~$ rvm use 2.0.0
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
回答by BroiSatse
Your console is not running as a login shell and hence have no access to rvm function. If you are running Ubuntu, you can:
您的控制台未作为登录 shell 运行,因此无法访问 rvm 功能。如果您正在运行 Ubuntu,您可以:
- Open console
- Select Edit -> Profile Preferences
- Select tab: Title and Command
- Check box 'Run command as a login shell'
- Restart terminal
- 打开控制台
- 选择编辑 -> 配置文件首选项
- 选择选项卡:标题和命令
- 复选框“将命令作为登录 shell 运行”
- 重启终端
回答by inquisitive
Type bash --loginfrom your terminal. And then give rvm use 2.0.0
输入bash --login您的终端。然后给rvm use 2.0.0
回答by akbarbin
It seems like your rvm does not load ".bash_profile" properly. I have done to fix it in MAC OS X or Ubuntu 14.04 by opening terminal and write:
您的 rvm 似乎没有正确加载“.bash_profile”。我已经通过打开终端并写入在 MAC OS X 或 Ubuntu 14.04 中修复它:
source ~/.rvm/scripts/rvm
回答by John Varghese
My env is OSX Yosemite. Had the same issue .... solved by adding the following
我的环境是 OSX Yosemite。有同样的问题....通过添加以下内容解决
1) edit and add the following line to .bash_profilefile.
1) 编辑以下行并将其添加到.bash_profile文件中。
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
2) Restart terminal and try RVM command again
2)重新启动终端并再次尝试RVM命令
回答by hhzhu
If you don't want that every time you open a terminal, do the suggestion above again, just add
如果您不想每次打开终端时都这样,请再次执行上述建议,只需添加
source ~/.rvm/scripts/rvm
at the end of ~/.bashrc
在......的最后 ~/.bashrc
回答by Sumit Munot
The error is due to rvm is not running as in login shell. Hence try the below command:
该错误是由于 rvm 没有像在登录 shell 中那样运行。因此尝试以下命令:
/bin/bash --login
You will able run rvm commands instantly as login shell in terminal.
您将能够在终端中作为登录 shell 立即运行 rvm 命令。
Thanks!
谢谢!
回答by Vigintas Labakojis
Same principle as other answers, just thought it was quicker than re-opening terminals :)
与其他答案相同的原则,只是认为它比重新打开终端更快:)
bash -l -c "rvm use 2.0.0"
回答by Siva Praveen
You need to add source ~/.rvm/scripts/rvmto ~/.your_shellrc file. From now when you load a shell, rvm will be loaded.
您需要添加source ~/.rvm/scripts/rvm到~/.your_shellrc file. 从现在开始,当您加载 shell 时,将加载 rvm。
For example:
例如:
if you are using zsh shell, need to add in ~/.zshrcfile
如果您使用的是 zsh shell,则需要在~/.zshrc文件中添加
if you are using bash shell, need to add in ~/.bashrcfile
如果您使用的是 bash shell,则需要在~/.bashrc文件中添加
And then open a new tab to see the effect.
然后打开一个新标签查看效果。
回答by Arjun
For me in Ubuntu(18.08), I have added below line in .bashrc and it works.
对于我在 Ubuntu(18.08) 中,我在 .bashrc 中添加了以下行并且它有效。
source /home/username/.rvm/scripts/rvm
Please add this line.
请添加这一行。
回答by WiredIn
From a new Ubuntu 16.04 Installation
从新的 Ubuntu 16.04 安装
1) Terminal => Edit => Profile Preferences
1) 终端 => 编辑 => 配置文件首选项
2) Command Tab => Check Run command as a login shell
2)命令选项卡=>检查运行命令作为登录shell
3) Close, and reopen terminal
3)关闭并重新打开终端
rvm --default use 2.2.4

