cannot load such file — rubygems.rb
Try this:
rvm fix-permissions
rvm reinstall 2.1.2
cannot load such file -- rubygems.rb (LoadError)
It seems that the rspec binary was only installed for your previous ruby version. Therefore it is found, but not guaranteed to work.
I'd recommend to use something like rvm
(https://rvm.io/) or rbenv
(https://github.com/rbenv/rbenv). Both of them can easily handle different ruby versions while maintaining dependencies (e.g. different load paths, different gem versions, etc.). I'd even use rvm
if there is only one single ruby version installed on a system.
cannot load such file -- rubygems.rb
I would recommend uninstalling ruby-2.1.0 and then reinstalling it as it seems like your current installation is corrupted.
rvm uninstall 2.1.0
rvm install 2.1.0
`require': cannot load such file -- rubygems.rb when installing ruby and rubygems with rvm
It turns out that my problem was the fact that I had created a symbolic link to gem
manually in /usr/bin
. After deleting the symbolic link, I reinstalled everything using the following commands:
rvm implode
\curl -L https://get.rvm.io | bash -s stable --ruby
source /home/<username>/.rvm/scripts/rvm
after which
gem install rails
worked like a charm.
no such file to load -- rubygems (LoadError)
I have a hunch that you have two ruby versions. Please paste the output of following command:
$ which -a ruby
updated regarding to the comment:
Nuke one version and leave only one. I had same problem with two versions looking at different locations for gems. Had me going crazy for few weeks. Put up a bounty here at SO got me same answer I'm giving to you.
All I did was nuke one installation of ruby and left the one managable via ports. I'd suggest doing this:
- Remove ruby version installed via ports (yum or whatever package manager).
- Remove ruby version that came with OS (hardcore rm by hand).
- Install ruby version from ports with different prefix (
/usr
instead of/usr/local
) - Reinstall
rubygems
cannot load such file -- rubygems/defaults/ruby error?
If you're loading in a YAML file that has frozen classes that aren't defined you'll have to load those prior to deserializing this file.
I don't know what you'll encounter, it just runs until it stumbles over the first thing, but if you need DateTime
then require 'date'
might fix that. Whatever class is missing you need to do the same thing, track down where it's defined and require
it prior to the YAML.load
part.
Related Topics
Can't Convert Symbol into String
Running Multiple Background Parallel Jobs with Rails
Customize Error Message with Simple_Form
Rails: Find Rows Without Connection in Habtm Relation
Deploy with Capistrano Failing
How Does Pack() and Unpack() Work in Ruby
Get Title, Content via Link in Rails
Stream Multiple Body Using Async Sinatra
How to Split String into Only Two Parts with a Given Character in Ruby
Why Is Ruby's Date Class Automatically Loaded But Datetime Is Not
Constants or Class Variables in Ruby
How to Iterate Through an Array Starting from the Last Element? (Ruby)
How to Safely Join Relative Url Segments
Rails 4.1 Mailer Previews and Devise Custom Emails
Testing After_Commit with Rspec and Mocking
Check If a File Exists Using a Wildcard