我想在我的Linux Mint 12上安装ruby。
我正在关注this tutorial和this one。
当我运行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.
如何解决?
编辑:@ ka8725
已安装 bunzip2
。当我运行cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
我看到了
[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
另一个编辑@EVERYONE:)
这里发生了什么:
rvm requirements
输出unrecognized error etc
。但是rvm notes
将向我显示我应该安装的所需内容。 但是当我安装这些东西时,rvm将被删除
所以我必须重新安装大声笑! :)一次,两次,十次,永远:)这会发生什么
这些是我需要的包
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
答案 0 :(得分:14)
使用
卸载并重新安装rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
对于后代,我将添加错误的部分
Installing Ruby from source to: /usr/share/...
让我想到了rvm的安装破坏,正如我所说,它通常完全包含在~/.rvm
目录中。
答案 1 :(得分:6)
我解决了我的问题:
rvm get head
rvm reload
和rvm install 1.9.3
答案 2 :(得分:6)
按照其中一条评论中的建议进行rvm更新,给了我一些关于如何解决问题的错误。我按照错误中的建议清除了apt-get ruby-rvm并安装了curl。工作就像一个魅力。查看文件名,rvm的apt-get版本正在抓取它看起来因为某些原因缺少该版本的最后一部分。它不应该是ruby-1.9.3-.tar.bz2,而应该是ruby-1.9.3-p327.tar.bz2或类似的东西。
以下是我所做的以及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
完成!
答案 3 :(得分:2)
问题已解决,以下是您想知道的方式:
正如 s.m。所说,我卸载了所有内容,然后我以普通用户的身份打开了另一个终端会话并运行:
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
然后我以正常用户NOT ROOT
运行source /home/my-desktop-username/.rvm/scripts/rvm
然后我作为普通用户运行rvm requirements
。然后我复制要求并关闭会话,打开 root 会话并使用{安装要求{1}}
然后我关闭会话并打开普通用户会话并运行sudo
如果您将此命令作为 root 运行,则会说{{1}未安装,并建议您使用rvm install ruby-1.9.3-p125
安装不要这样做!
所以基本上我有两个问题,我所遵循的教程没有说我应该运行
rvm
并没有说我不应该将sudo apt-get install rvm
作为 root , s.m 告诉我。感谢大家,尤其是 s.m
不要相信博客,Youtube用户或论坛。只信任STACKOVERFLOW用户!
答案 4 :(得分:1)
你试过这个答案Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v吗?
你接缝使用“apt-get broken rvm”确保你按照上面的答案。
答案 5 :(得分:1)
我和bunzip2有同样的问题。
〜/ .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
事实证明,下载的文件是rvm网站的HTML主页,而不是存档本身。
所以,如果像我一样以前所有的解决方案都没有成功。检查存档的文件类型:
$ 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
如果你得到这样的东西,只需删除档案并尝试重新安装。
答案 6 :(得分:1)
如果您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>
所以,rvm并不知道在哪里可以找到ruby-1.9.3(似乎路径被破坏了#3; .tar&#39;)
并且,1.9.1&#34;兼容性&#34;与1.9.3是Ubuntu中的一个(不那么有趣)笑话。
我的修复是:
rvm package install openssl
rvm install ruby-1.9.2 --with-openssl-dir=/usr/share/ruby-rvm/usr
因为1.9.2匹配所有我的宝石依赖(例如nokogiri)
答案 7 :(得分:1)
对于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
。
答案 8 :(得分:0)
cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
在我看来,你还没有安装bunzip2
。你应该安装它