可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
List the ruby versions
console:~$ rvm list
rvm rubies
ruby-2.0.0-p481 [ i686 ]
# => - current
# =* - current && default
# * - default
Try to use a specific version of 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.
回答1:
Your console is not running as a login shell and hence have no access to rvm function. If you are running Ubuntu, you can:
- Open console
- Select Edit -> Profile Preferences
- Select tab: Title and Command
- Check box 'Run command as a login shell'
- Restart terminal
回答2:
Type bash --login
from your terminal. And then give rvm use 2.0.0
回答3:
My env is OSX Yosemite. Had the same issue .... solved by adding following
1) edit and add [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" to .bash_profile file
2) Restart terminal and try RVM command again
回答4:
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:
source ~/.rvm/scripts/rvm
回答5:
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
回答6:
Same principle as other answers, just thought it was quicker than re-opening terminals :)
bash -l -c "rvm use 2.0.0"
回答7:
The error is due to rvm is not running as in login shell. Hence try the below command:
/bin/bash --login
You will able run rvm commands instantly as login shell in terminal.
Thanks!
回答8:
You need to add source ~/.rvm/scripts/rvm
to ~/.your_shellrc file
. From now when you load a shell, rvm will be loaded.
For example:
if you are using zsh shell, need to add in ~/.zshrc
file
if you are using bash shell, need to add in ~/.bashrc
file
And then open a new tab to see the effect.
回答9:
From a new Ubuntu 16.04 Installation
1) Terminal => Edit => Profile Preferences
2) Command Tab => Check Run command as a login shell
3) Close, and reopen terminal
rvm --default use 2.2.4
回答10:
For me in Ubuntu(18.08), I have added below line in .bashrc and it works.
source /home/username/.rvm/scripts/rvm
Please add this line.
回答11:
FWIW- I just ran across this as well, it was in the context of a cancelled selenium run. Perhaps there was a sub-shell being instantiated and left in place. Closing that terminal window and opening a new one was all I needed to do. (macOS Sierra)