How to change gem package manager's version? - ruby-on-rails

Currently I am having gem package manager version 2.0.14, I found it by running
gem -v
but how to downgrade the package manager to version 1.8.25. Every search attempt to find this leads me to, how to upgrading or downgrading a particular gem.

maybe you are referring to rvm?
rvm list
rvm use 2.0.0-p353 // just a sample version

Gem can be updated using:
gem update --system
or
sudo gem update --system

This may help you:
sudo gem update --system 1.8.25 # If you don't mention version then by default it will update with latest one
More information about downgrading/upgrading rubygems: http://rubygems.rubyforge.org/rubygems-update/UPGRADING_rdoc.html

Related

NameError: uninitialized constant Gem::SourceIndex

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.

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

Mysql gem install query

When installing the Mysql gem and I have RVM installed, do I install with sudo gem install mysql or do I do it through the rvm some how??
many thanks.
You just want to switch into your RVM profile and then do a gem install mysql. Normally you don't want to use the sudo when install gems into an RVM profile.
type rvm list then you'll see which ruby version is active. running gem install will install the gem for that verison of ruby.

gem --version different to sudo gem --version :(

I'm a bit of a Linux noob trying to get ruby, rails, mysql and sqlite all playing nicely on ubuntu 10. I am getting errors, and I realized that the versions are different for sudo versus normal user!
mpw#ubuntu:~/.rvm/gems/ruby-1.9.2-p0$ gem --version
1.3.7
mpw#ubuntu:~/.rvm/gems/ruby-1.9.2-p0$ sudo gem --version
1.3.5
I have used RVM to install it, but it seems that I have conflicting versions. How to fix?
I did the same installation mistake before, but following these instructions worked. http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html
sudo gem --version most likely is using the system gem i.e the one you get when you do rvm system. This is because sudo changes user to root and you probably didn't do sudo rvm use 1.9.2 or something similar. Try doing sudo which gem and which gem to confirm this.
You can update the version used by root by doing sudo gem update --system. However note that you are still most likley using different gem paths when using sudo gem and gem if you are not using the system gem executable by default i.e rvm use system.
Please try a
sudo which gem
resp
which gem
to get the information which gem you are using.
I second the opinion of the answer above that most probably you are using different gem versions and paths.

Installing Rails ERROR: could not find rails locally or in a repository

I've been poking around the internet looking for a solution on this one... with no luck..
I'm new to rails... If anyone has an idea, I'd love to hear it. Much appreciated!
I enter:
LW:src liamwright$ sudo gem install rails --include-dependencies
And Get:
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: could not find rails locally or in a repository
I am running:
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
Mac OS X 10.5.8
I also tried:
gem sources -r gems.rubyonrails.org
And Get:
source gems.rubyonrails.org not present in cache
Just to check...
...try doing a sudo gem update --system before installing Rails to make sure you have the latest RubyGems installed?
EDIT: Actually, if your RubyGems install is really old, you might need to follow the alternate directions on Gemcutter.
Might want to make sure you have the newest rubygems:
sudo gem install rubygems-update
sudo gem update --system
Then:
sudo gem install rails
I came across this solution on Albertux' blox. Running this script will fix it (It worked perfectly for me on an Ubuntu 9.10 machine):
#!/bin/bash
#(download the latest on http://rubyforge.org/frs/?group_id=126)
wget http://rubyforge.org/frs/download.php/43984/rubygems-update-1.3.0.gem
sudo gem install rubygems-update-1.3.0.gem
sudo update_rubygems
# now this work:
sudo gem update --system
echo "done."
I've just had the same problem trying to upgrade rubygems from 1.2.0 to 1.3.7.
Setp-1)
So I just downloaded rubygems-update-1.3.7.gem from http://rubyforge.org/frs/?group_id=126
Setp-2)
gem install rubygems-update-1.3.7.gem
Setp-3)
update_rubygems
and it work for me.

Resources