当我尝试在 Ubuntu 12.10 中安装 rails 时,出现此错误:
$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
所以我完全删除了rvm:
rvm implode
sudo rm -rf ~/.rvm
删除了我的脚本调用.bashrc
和.bash_profile
并检查它们是否真的被移除:
env | grep rvm #no output, so rvm is removed
ruby -v #The program 'ruby' can be found in the following packages: blabla
我已经通过 sudo apt-get install 获得了这些:
curl zlib1g-dev zlib1g libssl-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
然后从头开始安装
curl -L https://get.rvm.io | bash -s stable --ruby --auto-dotfiles
然后运行该行并重新启动终端关于此消息:
* To start using RVM you need to run `source /home/adige/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
然后rvm pkg install readline
但完成错误:
...
Error running 'autoreconf -is --force', please read /home/adige/.rvm/log/readline/autoreconf.log
...
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
我想它无论如何都安装了,对吧?在重新安装所有 rubies 之前,我当然安装了 zlib:
# w/out verify, it gives checksum error
rvm pkg install zlib --verify-downloads 1
然后再次运行rvm reinstall all --force
并完成错误:
...
Install of ruby-1.9.3-p374 - #complete
Making gemset ruby-1.9.3-p374 pristine.
Error running '' under ,
please read /home/adige/.rvm/log/ruby-1.9.3-p374/gemset.pristine.log
Making gemset ruby-1.9.3-p374@global pristine.
然后重新安装带有 zlib 支持的 ruby:
rvm reinstall 1.9.3-p374 --with-zlib-dir=$rvm_path/usr
它返回相同的错误和相同的日志,但无论如何都完成了。
最后我尝试再次安装rails gem,但是cannot load such file -- zlib
!
这是rvm信息
我究竟做错了什么?