rvm 安装:ruby 安装错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9439502/
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 install: ruby installation error
提问by Lynob
I want to install ruby on my Linux Mint 12.
我想在我的 Linux Mint 12 上安装 ruby。
I am following this tutorialand this one.
when I run rvm install 1.9.3I see this error:
当我运行时,rvm install 1.9.3我看到这个错误:
Installing Ruby from source to: /usr/share/ruby-rvm/rubies/ruby-1.9.3, this may take a while depending on your cpu(s)...
ruby-1.9.3 - #fetching
ruby-1.9.3 - #extracting ruby-1.9.3- to /usr/share/ruby-rvm/src/ruby-1.9.3
ERROR: Error running 'bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_4428', please read /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
ERROR: There has been an error while trying to extract the source.
Halting the installation.
ERROR: There has been an error fetching the ruby interpreter. Halting the installation.
How to fix it?
如何解决?
EDIT: @ka8725
编辑:@ka8725
bunzip2is installed. When i run cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
bunzip2已安装。当我跑cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
I see
我懂了
[2012-02-25 01:11:55] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_32604
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:12:16] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_32740
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:13:50] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_383
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:13:52] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_474
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:13:58] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_568
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:18:57] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_4428
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
ANOTHER EDIT @EVERYONE :)
另一个编辑@EVERYONE :)
here whats happening guys:
这里发生了什么事伙计们:
rvm requirementsoutputs unrecognized error etc. However rvm noteswill show me the needed stuff that i should install. BUTwhen i install these things, rvm will be removed
and so i have to reinstall lol!! :) once, twice, ten times, forever:) this what would happen
rvm requirements输出unrecognized error etc。但是rvm notes会告诉我我应该安装的需要的东西。但是当我安装这些东西时,rvm 将被删除,所以我必须重新安装哈哈!!:) 一次,两次,十次,永远:) 这会发生什么
these are the packages that i need
这些是我需要的包
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
回答by s.m.
Uninstall and reinstall rvmwith
卸载并重新安装rvm使用
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
For posterity, I'll add that the part of the error that says
对于后代,我会补充说错误的部分
Installing Ruby from source to: /usr/share/...
is what got me thinking about a broken installation of rvm which, as I said, is normally entirely contained in the ~/.rvmdirectory.
是什么让我想到 rvm 安装损坏,正如我所说,它通常完全包含在~/.rvm目录中。
回答by Kaio Max
I solved my problem simply doing:
我简单地解决了我的问题:
rvm get headrvm reloadand rvm install 1.9.3
rvm get headrvm reload和 rvm install 1.9.3
回答by user1881102
Doing an rvm update as suggested in one of the comments gave me some good errors on how to fix the problem. I purged apt-get ruby-rvm as suggested in the errors and installed with curl. Worked like a charm. Looking at the file name the apt-get version of rvm is grabbing it looks like the last part of the version is missing for some reason. Instead of ruby-1.9.3-.tar.bz2 it should be ruby-1.9.3-p327.tar.bz2 or something to that effect.
按照其中一条评论的建议进行 rvm 更新给了我一些关于如何解决问题的很好的错误。我按照错误中的建议清除了 apt-get ruby-rvm 并使用 curl 安装。像魅力一样工作。查看 rvm 的 apt-get 版本正在抓取的文件名,由于某种原因,该版本的最后一部分似乎丢失了。而不是 ruby-1.9.3-.tar.bz2 它应该是 ruby-1.9.3-p327.tar.bz2 或类似的东西。
Here is what I did and what was suggested by the errors after rvm update:
这是我所做的以及 rvm 更新后错误建议的内容:
sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
open new terminal and validate environment is clean from old rvm settings:
env | GREP_OPTIONS= \grep rvm
install RVM:
curl -L https://get.rvm.io | bash -s stable
fix some more screwed up stuff from apt-get ruby-gem
make ~/.bash_profile look like this(it loads rvm as a function in bash):
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
update RVM:
rvm update
rvm reload
install ruby
rvm install 1.9.3
rvm use 1.9.3 --default
install current rubygems
rvm rubygems current
install rails
gem install rails
Done!
完毕!
回答by Lynob
Issue solved, here's how in case you want to know:
问题已解决,以下是您想知道的方法:
As s.m.said, I uninstalled everything, then I opened another terminal session as a normal user and run:
正如sm所说,我卸载了所有内容,然后以普通用户身份打开另一个终端会话并运行:
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
then i run source /home/my-desktop-username/.rvm/scripts/rvmas a normal user NOT ROOT
然后我以普通用户身份运行source /home/my-desktop-username/.rvm/scripts/rvmNOT ROOT
then i run rvm requirementsas a normal user.Then I copy the requirements and close the session, open a rootsession and install the requirements using sudo
然后我rvm requirements以普通用户身份运行。然后我复制需求并关闭会话,打开一个根会话并使用安装需求sudo
Then I close the session and open a normal user sessionand run rvm install ruby-1.9.3-p125if you run this command as root, it will say that rvmis not installed and will suggest that you install it using sudo apt-get install rvmDon't do that!
然后我关闭会话并打开一个普通用户会话并运行,rvm install ruby-1.9.3-p125如果您以root身份运行此命令,它会说rvm未安装并建议您使用Don't do that安装它sudo apt-get install rvm!
So basically I had two problems, the tutorials that i followed didn't say that i should run
所以基本上我有两个问题,我遵循的教程没有说我应该运行
source /home/my-desktop-username/.rvm/scripts/rvmand didn't say that I should not run rvmas root, s.mtold me that. Thanks to everyone, especially to s.m
source /home/my-desktop-username/.rvm/scripts/rvm并没有说我不应该rvm以root身份运行,sm告诉我的。感谢大家,尤其是sm
Don't trust bloggers, Youtube users or forums. ONLY TRUST STACKOVERFLOW USERS!
不要相信博主、Youtube 用户或论坛。只信任 STACKOVERFLOW 用户!
回答by mpapis
have you tried this answer Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v?
你有没有试过这个答案 Installed Ruby 1.9.3 with RVM 但命令行不显示 ruby -v?
it seams you use "apt-get broken rvm" make sure you follow the above answer.
它接缝您使用“apt-get Break rvm”确保您遵循上述答案。
回答by Andrew
If you cat /usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2you will see
如果cat /usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2你会看到
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.2.1</center>
</body>
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.2.1</center>
</body>
So, rvm doesn't know where to find ruby-1.9.3 (it seems the path is mangled around '3-.tar')
所以,rvm 不知道在哪里可以找到 ruby-1.9.3(似乎路径在 '3-.tar' 周围被破坏了)
And, 1.9.1 "compatibility" with 1.9.3 is a (not so funny) joke in Ubuntu.
而且,1.9.1 与 1.9.3 的“兼容性”在 Ubuntu 中是一个(不太好笑)的笑话。
The fix for me was:
对我来说修复是:
rvm package install openssl
rvm package install openssl
rvm install ruby-1.9.2 --with-openssl-dir=/usr/share/ruby-rvm/usr
rvm install ruby-1.9.2 --with-openssl-dir=/usr/share/ruby-rvm/usr
As 1.9.2 happened matched all of my gem dependencies (e.g. nokogiri)
由于 1.9.2 发生匹配我所有的 gem 依赖项(例如 nokogiri)
回答by uberdave
For Ubuntu 18.10, I had the same error after installing via APT. rvm install 2.5.1 failed with the same error as referenced. After completing the instructions for Ubuntu on github and restarting my VPS, ruby v 2.6.3 installed using the command 'rvm install ruby' As I was on a vps, I had to run
source /etc/profile.d/rvm.shfirst.
对于 Ubuntu 18.10,通过 APT 安装后我遇到了同样的错误。rvm install 2.5.1 失败,错误与引用相同。在 github 上完成 Ubuntu 的说明并重新启动我的 VPS 后,使用命令“rvm install ruby”安装了 ruby v 2.6.3 由于我在 vps 上,我必须先运行
source /etc/profile.d/rvm.sh。
回答by Cecile V.
I had the same problem with bunzip2.
我对 bunzip2 有同样的问题。
A tail on ~/.rvm/log/ruby-1.9.3-p125/extract.log said:
~/.rvm/log/ruby-1.9.3-p125/extract.log 上的一条尾巴说:
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
It turns out that the downloaded file was the HTML homepage of rvm website instead of the archive itself.
原来下载的文件是rvm网站的HTML主页,而不是存档本身。
So if like me all previous solutions didn't worked out. Check file type of your archive:
因此,如果像我一样,以前的所有解决方案都没有奏效。检查存档的文件类型:
$ file ruby-1.9.3-p125.tar.bz2
ruby-1.9.3-p125.tar.bz2: HTML document, UTF-8 Unicode text, with very long lines
If you get something like this, just remove the archive and try to install it again.
如果你得到这样的东西,只需删除存档并尝试再次安装它。
回答by ka8725
cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
It seems to me you don't have installed bunzip2. You should install it
在我看来你没有安装bunzip2. 你应该安装它

