I am new to ruby.
OS: Windows XP
Ruby Version --ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
When I run
gem update --system after installing ruby
I am getting this error
C:\Documents and Settings\abhisheksreepal>gem update --system
Updating RubyGems
Updating rubygems-update
ERROR: While executing gem ... (Gem::InstallError)
invalid gem format for C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5.gem
I think it might be a corrupted download - Gems has downloaded a bad copy of the rubygems-update package into the cache, and every time that you run the update function it tries to use that cached copy.
Try deleting C:/Ruby/lib/ruby/gems/1.8/cache/rubygems-update-1.3.5.gem and trying again.
If that doesn't work, uninstall the version of Ruby that you are using now, and use the Release Candidate of RubyInstaller. The RubyInstaller supersedes the One-Click Installer, and has a newer version of RubyGems.
Related
I'm using rbenv, ruby 2.6.5, and attempting to use bundler 2.0.2. Currently when I run gem list, bundler 2.0.2 is the only version shown on the screen. However, when I run bundle install in my project, an error is thrown stating that my current bundler version is 2.1.2. If I run bundler version in the shell, it indeed says 2.1.2. Where can I find this version and eliminate it?
Thanks,
Ed
Uninstall all versions of bundler with gem uninstall bundler and install the version you need again.
I have installed many flavors of ruby on rvm, and using following command to change rvm ruby versions.
rvm use 1.9.3
then ruby -v gives me following result
ruby 1.9.3p551 (2014-11-13 revision 48407) [i686-linux]
but when i try to run any commands like rails s or bundle install
it gives me following error
Your Ruby version is 2.3.1, but your Gemfile specified 1.9.3
Using
rvm list
you can get list of ruby version on your system along with current & default versions.
If ruby version is not specified in Gemfile, then it is generally considering default rvm version.
But if it is specified in Gemfile, then that version of ruby should be installed in your system along with its bundler.
First make sure ruby version either installing or using it,
rvm install '1.9.3'
rvm use '1.9.3'
To install bundle of required ruby version, run this command
gem install bundler
That's can happens, when you trying to use fresh installed ruby without bundler, all newest installed ruby should also include bundler installation.
$> rvm use 1.9.3 && gem install bundler # may terminal reload needed
$> bundle install
$> bundle exec rails s
I'm using OS X 10.10.5 (Yosemite). I'm trying to clone the github repo for MacDown. The instructions in the README say that after cloning one should do
git submodule init
git submodule update
bundle install
bundle exec pod install
I'm not a ruby programmer, so I had to install Bundler. The first two steps ran fine, but when I tried to run bundle install I got the error
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with the current version, ruby 2.0.0p481
So I tried brew install ruby and now I have
saul#miniMac ✓ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
However, bundle install gives me the same error message as before. It's clear that it's finding the ruby at /usr/bin/ruby instead of the one at /usr/local/bin/ruby. How do I correct this?
I thought that perhaps the problem was that I had installed bundler before upgrading ruby, neither sudo gem uninstall bundler nor sudo gem uninstall bundle has any effect, and I don't know what else to try.
Here is all the output, in case it's relevant:
saul#miniMac ✓ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with
the current version, ruby 2.0.0p481
EDIT:
Thanks for the suggestions. I tried gem install bundler again, but it didn't help. I got the same error message. Here's what I get from bundle env
saul#miniMac ✗ bundle env
Environment
Bundler 1.13.6
Rubygems 2.0.14
Ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Git 2.5.4 (Apple Git-61)
Gemfile
source 'https://rubygems.org'
gem 'cocoapods', '0.39.0'
Gemfile.lock
<No /Users/saul/Projects/macdown/Gemfile.lock found>
EDIT 2:
saul#miniMac ✓ which -a bundle
/usr/local/bin/bundle
/usr/bin/bundle
It seems that your PATH may have an entry that points to your older version of Ruby and despite having a newer version (2.3.1) it gets to use the first ruby binary it finds in one of the entries it finds in your PATH, which happens to be the old version. You could try to add your latest Ruby path as the first entry of your PATH variable, but in case a sub-shell is run and the default PATH is loaded the path to your latest Ruby would be overwritten. That being said, I think the easiest would be to use rvm here to make sure your environment is all set up with the version you intend to use at any given time. RVM can manage multiple versions of ruby in the same system. Read more about RVM here.
Run all the following commands in the same terminal window:
Install rvm: curl -sSL https://get.rvm.io | bash -s stable
Add rvm binary to PATH: export PATH="$PATH:$HOME/.rvm/bin"
Install ruby version you need: rvm install 2.3.1
Configure the current shell to use a specific version of Ruby like so: rvm use 2.3.1
Run bundle install again
I tried installing github-pages using gem:
sudo gem install 'github-pages'
However, I get the following error:
ERROR: Error installing github-pages:
public_suffix requires Ruby version >= 2.0.
But when I checked my ruby version using ruby --version, it shows:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
So, my understanding is that gem is somehow referencing an older version of Ruby(previous was 1.9.3). How can I fix this problem? My OS is Ubuntu 14.04 and I upgraded ruby using ruby-install.
I believe you do not need to install github-pages globally, as you are trying.
Just removing sudo in front of your command will do the trick:
gem install 'github-pages'
I have rubygems 1.3.1 installed but I want to go back to 1.2.0. What's the command to downgrade rubygems?
This worked for me when downgrading from 1.5.2 to 1.4.2 because of old rails version:
sudo gem update --system 1.4.2
More information about downgrading/upgrading rubygems: https://github.com/rubygems/rubygems/blob/master/UPGRADING.md
Updated November 2011: Now that RVM's out, try running rvm install rubygems <version>.
If you're using RVM, then you can do this to remove current ruby gems, then upgrade/downgrade rubygems:
rvm install rubygems 1.4.2
This just worked for me on OSX to get from 1.5.0 back to 1.4.2
sudo gem uninstall -v '1.5.0' rubygems-update
sudo gem update --system --local
I had a similar problem in an old Rails 3 stack. When these type of issues occur, my recommendation is to go onto the production server that the application is currently running in and check out which rubygems version it is using:
gem -v
For me, it was using 1.8.24. So all I needed to do is downgrade my current rubygems which was generated from "rvm install 1.9.3", when I installed the old ruby for this app. I ran the following command:
$ rvm install rubygems 1.8.24 --force
And it worked. Note I am running Ubuntu 14.04 and the server I am using is also Ubuntu.
I used this command to go back to the gem version that my ruby version needed:
rvm rubygems current
If it gives checksum errors try
rvm rubygems current --verify-downloads 1
That did the trick for me.