Ruby-on-rails 未找到 RVM,安装 RVM 后
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5413775/
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 not found, after installing RVM
提问by pstack
I've found a couple similar posts regarding this same problem, but none of the solutions seem to apply, here.
我发现了一些关于同一问题的类似帖子,但似乎没有一个解决方案适用于此。
On a fresh Ubuntu 10.10 install, I follow the instructions for installing RVM:
在全新的 Ubuntu 10.10 安装中,我按照安装 RVM 的说明进行操作:
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Then I create .bash_profile and add the following line:
然后我创建 .bash_profile 并添加以下行:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
I restart the terminal and check RVM:
我重新启动终端并检查 RVM:
$ type rvm | head -1
-bash: type: rvm: not found
As the RVM installation guide explains to do so, I replaced the first line (below) in .bashrc with the second one, then indented everything in the rest of the file and added a fi.
正如 RVM 安装指南所解释的那样,我用第二行替换了 .bashrc 中的第一行(下面),然后缩进了文件其余部分中的所有内容并添加了一个 fi。
[ -z "$PS1" ] && return # original
if [[ -n "$PS1" ]]; then # replaced with this
Restarted terminal and still, no luck.
重新启动终端,仍然没有运气。
Then, I removed the line I added to .bash_profile in the beginning and added it to .bashrc, even though that isn't what the guide said to do. Still, no luck. I also entered it directly on the command line, with no change in behavior. When I run .rvm from ~/.rvm/bin/rvm it complains that there is no such file or directory as /.rvm/scripts/rvm and that the command was not fund.
然后,我删除了我在开头添加到 .bash_profile 的行并将其添加到 .bashrc,即使这不是指南所说的那样。尽管如此,还是没有运气。我也直接在命令行上输入它,行为没有变化。当我从 ~/.rvm/bin/rvm 运行 .rvm 时,它抱怨没有像 /.rvm/scripts/rvm 这样的文件或目录,并且该命令不是基金。
Of course, there isn't any such "scripts" directory inside of ./rvm, either -- so I'm not sure why it's looking for one? The only directories inside of .rvm are
当然,./rvm 中也没有任何这样的“脚本”目录——所以我不确定它为什么要寻找一个?.rvm 中唯一的目录是
archives
bin
config
gems
gemsets
log
man
rubies
src
tmp
user
The only thing I've found while googling for answers are other people complaining of similar problems and people telling them to add the instructed line to .bash_profile (which I obviously already did). At this point, I have nothing more to go on and am at an impasse.
我在谷歌上搜索答案时发现的唯一一件事是其他人抱怨类似的问题,人们告诉他们将指示行添加到 .bash_profile (我显然已经这样做了)。在这一点上,我无话可说,陷入了僵局。
Regards.
问候。
Resolution:As Andrew Marshall advised in his comments, below, I did an 'rm -rf .rvm' and reinstalled rvm. I had actually attempted this two times before posting here, with the same results every time. No odd messages in the install log, but no /scripts/ directory, either. Just so I could say I had, I did it a third time at Andrew's urging. This time, I checked and the /scripts/ directory existed. Running 'type rvm | head -1' confirmed it as a 'function' and I can now move on.
解决方案:正如 Andrew Marshall 在下面的评论中所建议的,我做了一个“rm -rf .rvm”并重新安装了 rvm。在这里发帖之前,我实际上已经尝试了两次,每次都得到相同的结果。安装日志中没有奇怪的消息,但也没有 /scripts/ 目录。为了我可以说我有,我在安德鲁的催促下做了第三次。这一次,我检查了 /scripts/ 目录存在。运行 'type rvm | head -1' 确认它是一个“函数”,我现在可以继续了。
采纳答案by Andrew Marshall
If there's no scriptsdirectory inside .rvm, it would seem that RVM failed to successfully complete installation. Delete the .rvmdirectory, try reinstalling, and look at the installation output closely to see if it's complaining about anything.
如果里面没有scripts目录.rvm,则RVM似乎无法成功完成安装。删除.rvm目录,尝试重新安装,然后仔细查看安装输出,看看它是否有任何抱怨。
回答by Benjamin Crouzier
Make sure that you restart a session after reinstalling, so that rvmis in your path.
确保在重新安装后重新启动会话,以便rvm在您的路径中。
You can try to logout/login.
您可以尝试注销/登录。
You can also open your shell as a login shell. Under ubuntu 12.04:
您还可以将 shell 作为登录 shell 打开。在 ubuntu 12.04 下:
- Open a terminal
Edit>Profile Preferences- Under tab Title and Command, check
run Command as a login shell - Open new terminal (
ctrl+alt+t) and typervm
- 打开终端
Edit>Profile Preferences- 在选项卡标题和命令下,检查
run Command as a login shell - 打开新终端 (
ctrl+alt+t) 并输入rvm

