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.
Related
So, it seems like ruby isn't able to find gems that are installed? The error:
/Users/userName/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- activesupport (LoadError)
from /Users/userName/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from test.rb:3:in `<main>'
I had ruby installed via RVM and brew on my Mac (El Capitan). I don't remember what I had done when I started getting this error when trying to run my ruby program. At the top of my program I have require 'json' and require 'rest-client', and require 'activesupport' Nothing abnormal there.
After a lot of googling, I ended up doing rvm implode and removing the .rvm files from my computer to completely uninstall rvm. I then tried installing ruby via brew, but was getting the same error. I then uninstalled the the brew version of ruby, and installed with rbenv. Still got the same error, but this time with the rbenv path to the kernal_require.rb file instead of the brew or rvm paths that it had showed before.
So something tells me that this is not something to do with rvm or brew or rbenv because I was getting the same error with the versions of ruby I tried for each one. The gems are installed. Why isn't it able to load them? Uninstalling and reinstalling the gems didn't help. I had to reinstall them anyway every time I uninstalled and reinstalled ruby.
gem env home returns this:
/Users/userName/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0
brew config returns this for ruby:
Ruby: /Users/userName/.rbenv/shims/ruby => /Users/userName/.rbenv/versions/2.3.0/bin/ruby
I have these included in my PATH:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
ruby -v returns this:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
I've checked for spaces in the file path, I've tried installing bundler and installing gems that way, but I'm still getting the same issue. What else can I look at to solve this problem?
You use
gem 'activerecord'
in the gemfile.
require 'active_support/all'
is used in the program.
It's slightly annoying when gems do this, but you can't always assume the files you require have the same name as in the Gemfile.
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'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 :)
TL;DR:
$ gem install rubyzip
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
And now in detail. I'm not sure which information is relevant, so I'm just gonna say it all.
I recently upgraded from OS X Snow Leopard to Lion (also upgraded Xcode to 4.2)
Everything worked just fine for a while
Today I decided to install some gems (RSpec, Cucumber), and I started getting date format warnings whenever I did anything with RubyGems
I decided to update RubyGems, from 1.3.6 (I'm not sure here) to current 1.8.11
The warning kept on popping up, so I tried to remove the gemset with rvm gemset empty, which also failed, because of some permission denied error (yes stupid me didn't write it down)
In result of that, I reinstalled Ruby via rvm remove 1.9.2 and rvm install 1.9.2 (I didn't forget to rvm use 1.9.2 --default after that.
I installed bundler gem install bundle and then tried to bundle install in my Rails 3.1.1 project, but it ends with error
Installing rubyzip (0.9.4)
Errno::EPERM: Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
An error occured while installing rubyzip (0.9.4), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '0.9.4'` succeeds before bundling.
gem install rubyzip -v '0.9.4' gives the above mentioned error
The README file says to download source and install from there via ruby install.rb, which also ends in error
$ ruby install.rb
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:841:in `install': wrong number of arguments (4 for 3) (ArgumentError)
from install.rb:21:in `block in <main>'
from install.rb:18:in `each'
from install.rb:18:in `<main>'
Even executing tests fro rubyzip ends up in bunch of errors
$ rake test
rake/gempackagetask is deprecated. Use rubygems/package_task instead
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -C test alltests.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- stdrubyexttest (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from alltests.rb:5:in `<main>'
rake aborted!
Command failed with status (1): [/Users/darth/.rvm/rubies/ruby-1.9.2-p136/b...]
Tasks: TOP => test
(See full trace by running task with --trace)
I'm out of ideas, what can I do?
I'm really not sure what caused this, but I managed to fix it by doing the following.
Since reinstalling Ruby 1.9.2 didn't help, I decided to be even more drastical and went down to rvm. I found out that I had version 1.1.something installed, which is about 9 months old.
I tried to update, but it didn't help, so rvm implode did the trick. I even had to sudo rm -rf ~/.rvm, probably because I managed to mess up some gem installs by adding sudo to them.
After reinstalling rvm and reinstalling 1.9.2, it seems like everything is working fine now, even with Xcode 4.2.
Lesson learned, rm -rf & reinstall is better than trying to upgrade from a year old version :)