简体   繁体   English

安装RVM时出现问题

[英]Problem installing RVM

I have executed the commands as prescribed in the instructions at the rvm website but things don't seem to work.. 我已经执行了rvm网站上的说明中规定的命令,但事情似乎不起作用..

Fetching the code from the git repository runs smoothly but when I try to use 从git存储库中获取代码可以顺利运行,但是当我尝试使用时

 rvm notes

Error: 错误:

/usr/local/bin/rvm: line 73: /home/cody/.rvm/scripts/rvm: No such file or directory

flashes in multiple lines and doesn't stop till I hit ctrl+C.. I am running Ubuntu 8.04 and currently I am running ruby 1.9.2.. Sorry, if I am missing out any necessary information. 多行闪烁并且直到我按下ctrl + C才停止。我正在运行Ubuntu 8.04,目前我正在运行ruby 1.9.2 ..对不起,如果我错过了任何必要的信息。 Thanks in advance. 提前致谢。

Ack, I didn't mean to post this as a comment on the question. Ack,我不是故意将此作为对该问题的评论。 Anyway, if I had to guess, I'd say you installed rvm using sudo or as root. 无论如何,如果我不得不猜测,我会说你使用sudo或root作为rvm安装。 If that is the case, remove it and reinstall without sudo: 如果是这种情况, 请将其删除并重新安装,不要使用sudo:

sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh \
  /usr/local/rvm /usr/local/bin/rvm
sudo /usr/sbin/groupdel rvm # this might fail, it's not that important

Open new terminal window/tab and make sure rvm is removed: 打开新的终端窗口/选项卡,确保删除rvm:

env | grep rvm

The output should be empty, sometimes it's needed to relogin, after it's empty you can continue: 输出应该是空的,有时它需要重新登录,在它为空之后你可以继续:

curl -sSL https://get.rvm.io | bash -s stable

It works perfectly fine installed for the local user. 它为本地用户安装完美。

你把这行添加到~/.bashrc吗?

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

Ok, for anyone who tried to install RVM using sudo and is now pulling their hair out trying to get it to install in $HOME/.rvm , here's what did it for me: 好吧,对于任何试图使用sudo安装RVM并且现在正试图将它安装在$HOME/.rvm ,这就是为我做的:

When you installed RVM using sudo , it created a file /etc/rvmrc , which contains the following: 当您使用sudo安装RVM时,它创建了一个文件/etc/rvmrc ,其中包含以下内容:

umask g+w  
export rvm_path="/usr/local/rvm"  

This makes all future attempts at installation (even when not run as sudo) install into /usr/local/rvm, which is NOT what you want for a single user installation. 这使得将来安装的所有尝试(即使不以sudo身份运行)安装到/ usr / local / rvm中,这不是您想要的单个用户安装。 So remove /etc/rvmrc and then you can run 所以删除/etc/rvmrc然后就可以运行了

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

and it will install properly into $HOME/.rvm 它将正确安装到$HOME/.rvm

I have executed the commands as prescribed in the instructions at the rvm website. 我按照rvm网站上的说明执行了命令。

WHICH commands? WHICH命令? There are several pages containing instructions to install RVM depending on whether you want a single-user "sandbox" or are installing system-wide for a multi-user system as the administrator. 有几个页面包含安装RVM的说明,具体取决于您是希望单用户“沙盒”还是作为管理员为多用户系统安装系统范围

Because you have RVM in /usr/local , I think you tried to do a system-wide install but didn't get it right. 因为您在/usr/local有RVM,我认为您尝试进行系统范围的安装,但是没有做到正确。 For 99% of us, that is the wrong installation method, and instead you should use the single-user installation, which is simple and puts everything in ~/.rvm . 对于99%的我们来说,这是错误的安装方法,相反,您应该使用单用户安装,这很简单,并将所有内容放在~/.rvm

Either way, be sure to read the entire instructions. 无论哪种方式,请务必阅读整个说明。 And, if doing a single-user install, finish the install with the "Post Install" modifications to ~/.bashrc or ~/.bash_profile for a single-user, then start a new terminal session. 并且,如果进行单用户安装,则对单用户完成对~/.bashrc~/.bash_profile的“安装后”修改的安装,然后启动新的终端会话。

When using the single-user install NEVER use sudo to install gems to a RVM-managed Ruby, even though the instructions for a gem might say to. 当使用单用户安装时, 永远不要使用sudo将gems安装到RVM管理的Ruby,即使gem的说明可能会说。

I have got same problem after installation. 安装后我遇到了同样的问题。 Then I restarted terminal and it started working poperly. 然后我重新启动终端,它开始正常工作。

Look at the section "Troubleshooting your install" here . 请在此处查看“安装故障排除”部分。 Since you are on Ubuntu, you probably need to make further mods to you .bashrc 因为你在Ubuntu上,你可能需要为你的.bashrc做进一步的mod

in .bashrc have you changed the 在.bashrc你改变了

[ -z "$PS1" ] && return

to

if [[ -n "$PS1" ]]; then

and added this to the end of the file: 并将其添加到文件的末尾:

fi 科幻

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

I just had a similar problem . 我刚遇到类似的问题

It turned out that many files in ~/.rvm/scripts/ and ~/.rvm/src/rvm/scripts/ which obviously should be executable did not have execute permissions. 事实证明,〜/ .rvm / scripts /和〜/ .rvm / src / rvm / scripts /中的许多文件显然应该是可执行的,但没有执行权限。 Running a script on both directories to set all files to executable solved that immediate problem. 在两个目录上运行脚本以将所有文件设置为可执行文件解决了这个直接问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM