NameError: uninitialized constant Gem::SourceIndex - ruby-on-rails

This error appears for a new rails app, with nothing modified, when visiting the homepage (after successfully running bundle install).
Here are the version numbers:
ruby: 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]
rails: 3.2.12
rvm: 1.18.14
gem: 2.0.0
bundler: 1.3.0.pre.8
Calling which ruby returns /Users/J/.rvm/rubies/ruby-1.9.3-p392/bin/ruby, which seems fishy, right?

You need to update Bundler: gem update bundler
RubyGems release 2.0 seems to be the trigger for the error:
RubyGems 2.0 includes several new features and many breaking changes. Some of these changes will cause existing software to break. . . . If you are using bundler be sure to install a 1.3.0.prerelease version or newer. Older versions of bundler will not work with RubyGems 2.0.
Here are the issue details.

Thanks!
Rails-7, ruby 3.1.2, had the same issue
solved it by gem update --system

Run:
gem update --system 1.8.24
Sounds like there's something buggy with latest.

Have you tried updating your RubyGems?
gem update --system

gem update bundle && gem update --system

For me it was all of the above + using the new one on my nginx config.

Related

Mismatched ruby version after downgrade from 2.4.1 to 2.3.3 while running bundle install

While attempting to solve another issue identified in this thread:
Error while trying to load the gem 'devise. ActiveSupport: Duration can't be coerced into Integer, I followed the suggested solution and changed my ruby version from 2.4.1 to 2.3.3 using rbenv. I also made similar changes in my Gemfile to reflect the new ruby version. However, when I tried to bundle install again, it throws an error saying that my ruby version is 2.4.1, when my Gem specified 2.3.3. However, running ruby -v shows my ruby version is on 2.3.3.
$ bundle install
Your Ruby version is 2.4.1, but your Gemfile specified 2.3.3
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
Any help here would be appreciated. Thank you!
Gem installation is specific to ruby version, so the bundler you're using is likely installed to your old ruby. Try installing bundler again:
gem install bundler
That should fix your problem.

Incorrect ruby version when installing bundle in rails project

I have a problem when running bundle install in the root of sharetribe rails's project. It shows me this error message:
Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
I tried installing rvm and installing the 2.3.1 version required to run this project but nothing changes and it still throwing this output.
Have anyone faced this problem before ?
Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
Steps to resolve this issue
1)rvm install ruby-2.3.1
2)gem install bundler
3)rvm use ruby-2.3.1
4)Bundle install
Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
If you run command ruby -v you can see that you have installed Ruby 2.4.0, when you look at the first line in your Gemfile specifies that you want to use Ruby 2.3.1.
You can do either install Ruby 2.3.1 or replace the first line in your Gemfile to with Ruby 2.4.0.
What does it say when you run bundle env in the terminal?
Is it the same ruby version?
I tried gem install bundler one time i had the same problem and bundle updated and worked.
You can read more about it here.
Good luck!

Cannot load gem during gem pristine

I am using rails on my local host and have recently been confronted with the following message.
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
Sounds fair enough, however when I run the suggested command, it hangs on installing the cairo gem with the following message.
Cached gem for cairo-1.12.8 not found, attempting to fetch...
ERROR: While executing gem ... (Gem::Exception)
Cannot load gem at [/usr/share/rubygems-integration/1.9.1/cache/cairo-1.12.8.gem] in /home/me/
What might be going on here?
You need to update your rubygems to the 2.1.0 or newer versions. The newest version is currently 2.4.5 it was updated Dec. 3rd 2014. Try this link to update. https://rubygems.org/gems/rubygems-update
Hi all I ended up finding a post that recommended I just reinstall ruby again. Seeing no other choice I did a rvm uninstall ruby then a rvm install ruby and set everything else back up and it went well. Unsatisfying but true :-P

How to specify gem version to an older version?

I tried to use a specific version for gem, as specified by Michael Hartl's ruby on rails tutorial.
I typed in $ gem update --system 1.8.24
but i got this output:
Latest version currently installed. Aborting.
How do I prevent this command from aborting? The tutorial notes that I must use the 1.8.24 version. Thanks!
We can user the following command to update the gem version.
gem update --system -v (version_number)
using this we can do downgrading the version also.
you might face issues when you downgrade from some random version. you have to update your rubygem to the latest version and then use
gem update --system version_number
To upgrade to the latest version, do
gem update --system

Rails 3.1 on Ubuntu 11.04 via RVM - uninitialized constant Psych::Syck

gem install rails --pre
ERROR: While executing gem ... (NameError)
uninitialized constant Psych::Syck
I can't seem to find any info on how to resolve this. Has anyone else had the same problem?
I am using a newly created gemset in RVM with Ruby 1.9.2
I had exactly same problem on mac via RVM. Specifying version is the rescue for me.
gem install rails --pre --version 3.1.0.rc1
update (2011-06-12) with rubygems 1.8.4, I can install rails 3.1.0.rc4 without specifying the version.
I had exactly the same problem, and the other solutions mentioned here didn't work for me.
However, this did:
gem update --system

Resources