Saturday, July 30, 2011

no such file to load -- zlib

If you have installed rvm and then ruby and now facing below issue while installing rails-
manohar@manohar-Inspiron-1525:~$ gem install rails
ERROR:  Loading command: install (LoadError)
no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand

Below steps should fix your problem as it worked for me.

$ rvm pkg install zlib
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr


HEROKU:

If you need to use you might face below problem after installing heroku gem and running heroku commands:

no such file to load -- net/https.
Try running apt-get install libopenssl-ruby (LoadError)
Below steps will work:
 
$ rvm remove 1.9.2 
$ rvm pkg install openssl
$ rvm install 1.9.2 -C --with-openssl-dir=$rvm_path/usr
 
And to resolve both zlib and libopenssl problem use below steps:

$ rvm remove 1.9.
$ rvm pkg install zlib
$ rvm pkg install openssl
$ rvm install 1.9.2 -C --with-openssl-dir=$rvm_path/usr  --with-zlib-dir=$rvm_path/usr