我rbenv
从 GitHub 安装:
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
我正在尝试安装 Ruby 2.2.0:
sudo /home/vagrant/.rbenv/bin/rbenv install 2.2.0
我该如何修复它?
以下是日志的最后几行:
installing bundle gems: /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
/tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- zlib (LoadError)
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/package.rb:46:in `<top (required)>'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/dependency_installer.rb:3:in `<top (required)>'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/ruby-build.20150209193236.15392/ruby-2.2.0/lib/rubygems.rb:556:in `install'
from ./tool/rbinstall.rb:717:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:716:in `each'
from ./tool/rbinstall.rb:716:in `block in <main>'
from ./tool/rbinstall.rb:749:in `call'
from ./tool/rbinstall.rb:749:in `block in <main>'
from ./tool/rbinstall.rb:746:in `each'
from ./tool/rbinstall.rb:746:in `<main>'
make: *** [do-install-all] Error 1
答案1
您没有安装 zlib。要获得正确的构建环境,请运行以下命令:
Ubuntu/Debian:
apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
CentOS/Fedora:
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
更多信息,请阅读ruby-build
维基百科。