I've just installed RVM on a new ubuntu 10.04 LTS server and one ruby, 1.9.2-p180. I've made a new gemset in my project folder, which has a Gemfile. I realised that in order to install the gems in the gemfile, i need to install bundler, so i did
gem install bundler
but, i get this error:
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
I googled around a bit and tried this:
rvm pkg install zlib
which installed ok but didn't solve the problem. I also tried installing the rake gem but got the same error trying to do that.
Kind of stuck...any suggestions? thanks, max
EDIT - btw, i can install the bundler gem fine outside of rvm, ie using system ruby.
EDIT2 - I got past this problem by removing the version of ruby, then installing it again with zlib:
rvm remove 1.9.2-p180
rvm install 1.9.2-p180 -C --with-zlib-dir=$rvm_path/usr
Now i can install bundler and all my gems ok. Hooray. Except, when i try to open my rails env (with rails s, rails c or rake db:create) i get this fatal error:
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/
1.9.1/rubygems/custom_require.rb:36:in `require':
/lib/libz.so.1: version `ZLIB_1.2.3.3' not found (required by
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/i686-linux/zlib.so) -
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/i686-linux/zlib.so (LoadError)
So, still not out of the woods zlib-wise. I don't know why zlib is causing such problems, any ideas?
Sorted it!
Running locate libz gives me
/home/max/.rvm/src/zlib-1.2.5/libz.a
/home/max/.rvm/src/zlib-1.2.5/libz.so
/home/max/.rvm/src/zlib-1.2.5/libz.so.1
/home/max/.rvm/src/zlib-1.2.5/libz.so.1.2.5
/home/max/.rvm/usr/lib/libz.a
/home/max/.rvm/usr/lib/libz.so
/home/max/.rvm/usr/lib/libz.so.1
/home/max/.rvm/usr/lib/libz.so.1.2.5
/lib/libz.so.1
/lib/libz.so.1.2.3.3
I just noticed that the version of libz in lib is 1.2.3.3 while the version i installed with rvm is 1.2.5. Is this the problem perhaps? In the /lib folder, zlib.so.1 is symlinked to it's neighbour file libz.so.1.2.3.3.
I tried symlinking it to /home/max/.rvm/usr/lib/libz.so.1.2.5 instead:
sudo rm /lib/libz.so.1
sudo ln -s /home/max/.rvm/src/zlib-1.2.5/libz.so.1 /lib/libz.so.1
and, that seems to have worked... i still don't really understand exactly what went wrong, though, so would welcome a more insightful solution/explanation :)
Related
On Linux Mint 17.3, I upgraded from Ruby 1.9.2 to Ruby 2.3.0 using RVM, and now the 'gem' CLI and every Ruby program that uses gems are returning the following error:
<internal:gem_prelude>:1:in require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in'`
I have tried reinstalling Ruby, switching to other versions (including back to 1.9.2), reinstalling RVM, and rvm fix-permissions, none of which have changed the error.
Any idea what's going on here?
EDIT: I was able to get CLI functionality back seemingly by repeatedly reinstalling 2.3.0 (rvm reinstall rather than uninstalling and reinstalling manually). However, programs that require gems are still breaking with the same error.
The below might help:
gem install rubygems-update
update_rubygems
If nothing helps, try to manually remove 1) all rubies from RVM and 2) rvm directory:
rm -rf /home/[username]/.rvm
and reinstall RVM from the scratch.
I am not a Ruby expert but wanted to figure out what is going on as I am trying to get compass working in a node app but my Ruby seems broken. Typing:
ruby --version
gets me:
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
I have Homebrew installed and have previously had issues with Ruby versions but it seems like it is installed and working. However when I enter a request with gem I get this error:
$ gem -h
Error loading RubyGems plugin "/Users/user_dir/.rvm/gems/ruby-2.1.1#global/gems/executable-hooks-1.3.1/lib/rubygems_plugin.rb": dlopen(/Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
in /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle (LoadError)
Error loading RubyGems plugin "/Users/user_dir/.rvm/gems/ruby-2.1.1#global/gems/gem-wrappers-1.2.4/lib/rubygems_plugin.rb": dlopen(/Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib in /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle (LoadError)
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://guides.rubygems.org
I noticed the reference to openssl but couldn't find any issues online about that.
I have tried installing compass on npm and RVM and Homebrew, so, at the moment, I don't know what versions are being used and where to begin trying to resolve the issue.
If you know what the issue is please let me know, or if you need further info about my system.
I looked at: "Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)" and
"Error loading RubyGems plugin ,openssl.bundle (LoadError)".
I didn't add npm or node tags as I am quite sure it is a Ruby issue, but left it in the question as I did try to install compass there as well.
I have tried fixing RVM, Homebrew etc., but it is still broken.
Are you using brew?
If so, brew update or brew upgrade breaks the Ruby runtime which is what caused a similar error for me.
The following solved the issue for me:
brew rm openssl
brew cleanup openssl
brew install openssl
rvm reinstall ruby
gem install compass
EDIT:
I finally found out that RVM has a default version, so every time I installed a new version it would revert to the old one (I guess this one had errors which is why I didn't notice the version issue).
If you go to:
~/.rvm/gems/
There will be a list of ruby versions and a default folder at the top. Following this page and entering:
rvm --default use 2.1.5
Fixed my problems (for now...)
ORIGINAL:
I tried a lot of different things but eventually got it to work, I have broken this answer down into the list of things I think may have contributed to the result as there were lots of things that didn't work.
This answer to an SO question I found led me down this path.
I reinstalled ruby but because the version in the answer(1.9.3) was older than 2.1.1p76 I just entered:
rvm get stable
then:
rvm reinstall ruby
this kept me on 2.1.1p76, then:
rvm gemset pristine
upgraded gem to 2.4.3
This bit is strange but I then tried to install compass in NPM and it worked but still would not run, then checking my ruby version again gave me 2.1.5p273 (there were no upgrades in between unless RVM gemset pristine updated ruby...).
I then tried the mygemset code from the SO answer but got more errors so I decided to just run
gem install bundler
This seemed to work, so I tried:
gem install compass
Which I had tried many times but this time it worked. It installed ffi-1.9.6.gem and 9 gems which I assume were dependancies.
The NPM package then worked and I currently don't have any errors showing up in ruby.
NOTE: I am not going to accept this answer as I don't really know why it worked, if you follow this be aware I don't know ruby and this was just to get compass working in NPM.
NOTE: Many answers had rbenv as a package manager, I wanted to resolve the situation with what was already on the system so I continued to work with RVM.
When attempting to run any rake, rails or bundle commands, I get following error:
/home/username/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': libcrypto.so.1.0.0: cannot open shared object file: No such file or directory - /home/username/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/digest/sha1.so
I have tried rvm pkg install openssl, rvm remove 1.9.3, rvm reinstall 1.9.3, reinstall bundler and all gems. I read on another forum that I may have to uninstall rvm, ruby and rails and start from scratch. Ugh - really?
Thanks in advance.
you need to read and follow the instructions displayed with:
rvm requirements
then remove the rvm installed openssl:
rm -rf $rvm_path/usr/
and reinstall ruby:
rvm reinstall 1.9.3-p194
I am trying to install sproutcore on a windows xp vm (virtualbox), for development, using RubyGems. When gems reaches haml-3.0.25.gem it stops with the error:
gem install sproutcore -V
...
ERROR: While executing gem ... (Zlib::DataError)
invalid stored block lengths
I have tried both Ruby 1.8.7 and 1.9.2 as well as RubyGems 1.7.1 and 1.8.1.
I tried downloading haml 3.1.1 with git and installing it manually, but the rake would not install. It said something about 'lib/haml' not found. The directory did exist.
Other gems install just fine under all the combinations I tried. I even tried installing it under my host OS (Win 7 32-bit), but it gave the same error. Installing haml by itself changes the error message only slightly:
gem install haml -V
...
ERROR: While executing gem ... (Zlib::DataError)
invalid code lengths set
Zlib compresses and decompresses data streams from what I have read, so it sounds like the haml gem might be corrupt (although I doubt).
I am at my wits end and could find no helpful advice anywhere.
Special thanks to #saner for his contribution. After a lot of frustration, this is how I finally installed sproutcore on a Windows XP VM running on a Windows 7 host.
1) Download and install Ruby 1.9.2-p180 (remember to tick the option to include the bin directory in the PATH variable).
2) Download DevKit 4.5.1 and extract it.
3) Open a command prompt and cd to the extracted directory.
4) Run:
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
5) Download RubyGems 1.7.2 and run setup.rb
6) From the command prompt run
gem install haml -v 3.0.24
gem install eventmachine --pre
gem install sproutcore --pre
Thats it.
Enjoy.
I was able to install SproutCore on Ruby 1.9.2:
Install Ruby 1.9.2-p180
gem install sproutcore --pre
gem install eventmachine --pre
gem uninstall thin
gem install mongrel
I needed to remove thin because starting sc-server ended with errors, SproutCore will use mongrel instead of thin.
Update:
I didn't mention that I use RubyGems 1.7.2 and I have installed DevKit and Cygwin.
I removed all versions of SproutCore, Mongrel and Haml, then I typed:
gem install sproutcore --pre, SproutCore v1.6.0.beta.1 was installed.
eventmachine --pre, eventmachine (1.0.0.beta.3 x86-mingw32) was installed
SproutCore works with this setup, using mongrel was not necessary.
My configuration: sproutcore (1.6.0.beta.1), ruby 1.9.2p180, gem 1.7.2, thin (1.2.11 x86-mingw32), eventmachine (1.0.0.beta.3 x86-mingw32), haml (3.0.25), gcc version 4.5.0 (GCC)
I know this is a really old question, but since I just experienced the same problem, I've decided to add my insights on it.
So, it happened while I was trying to install the same set of gems on two different machines with different architectures, with different locations and respectively in different networks. I.e. - my home mac and a remote linux server.
So, one particular gem (dm-sqlite-adapter) failed installing on both machines, and I even tried it couple of times, but always with the same result:
$ gem install dm-sqlite-adapter
ERROR: While executing gem ... (Zlib::DataError)
invalid code lengths set
Then I spent few minutes browsing the network for a solution, including reading this thread.
Since I didn't find any satisfying answer and I wasn't pleased with the idea of reinstalling everything, decided to act dumb and tried gem install one more time.. And it worked. Then tried the other machine - worked like a charm.
So as a conclusion I'd just guess that the problem came from the remote repo and maybe the gem hadn't even downloaded at all (I forgot to check that prior to succeeding installing it). But as I said - it's just a guess..
I have installed Ruby on Rails on my Ubuntu 10.04 Server by official tutorial: https://help.ubuntu.com/10.04/serverguide/C/ruby-on-rails.html
But I have some troubles with it. Please, help me!
1) I can't install ANY gem!
sudo gem install sqlite3-ruby
returns
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such
file to load -- mkmf (LoadError) from
extconf.rb:3
Gem files will remain installed in
/var/lib/gems/1.8/gems/sqlite3-1.3.3
for inspection. Results logged to
/var/lib/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
2) When i'am trying to get Rails version by command
rails -v
Server prints:
getopt: invalid option -- 'v'
Terminating...
If you are not set on using the packages in the Ubuntu repos(and I see no reason why you'd be), I'd suggest following this guide:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
Consider going through and making sure your sqlite3 libraries are installed. It looks as though you may be missing the required dependencies to build your gem. In this case you might try running this before installing your gem:
sudo apt-get install libsqlite3-dev
Also, try
rails --version
instead.