Trouble removing rake 0.9 - ruby-on-rails

I am having some trouble removing the rake gem version 0.9. I managed to run gem uninstall rake and I believed this to have deleted it. However, going back to gem list it still showed that it still exists.
Running gem env:
GEM PATHS:
/home/sean/.rvm/gems/ruby-1.9.2-p180
/home/sean/.rvm/gems/ruby-1.9.2-p180#global
I went into the #global directory and manually deleted it there, yet still it remains somewhere. I can see it when I run gem list. The 0.9 rake gem is causing problems for my Rails 3.0.7 application.
I ran gem list -d rake:
rake (0.9.0, 0.8.7)
Installed at
(0.9.0): /home/sean/.rvm/gems/ruby-1.9.2-p180#global
(0.8.7): /home/sean/.rvm/gems/ruby-1.9.2-p180
I don't see anything in the gems directory for ruby-1.9.2-p180#global

You should run
rvm use #global && gem uninstall rake -v 0.9.0
rvm use # && gem uninstall rake -v 0.9.0
to correctly remove rake 0.9.0 from rvm

In terminal type in: gem uninstall rake, then select version 0.9.0 when prompted.
Then modify your Gemfile within your Rails application:
gem 'rake', '0.8.7'
Then in terminal run:
bundle install
These steps should fix the problems you are having. Upgrade to rake again when you upgrade to rails 3.1.

If you're using rvm you get rake 0.9 installed "for free" in the global gemset which makes it hard (impossible?) to uninstall properly. gem uninstall rake is successful but doesn't actually remove rake 0.9. I had to do it manually for both REE and 1.9.2.
I edited the rake executable script (find with which rake) and added a:
puts "Gem.bin_path: #{Gem.bin_path('rake', 'rake', version)}
...before the last line. This prints (on my system):
Gem.bin_path: ~/.rvm/gems/ree-1.8.7-2011.03#global/gems/rake-0.9.0/bin/rake
To remove 0.9 cd into ~/.rvm/gems/ree-1.8.7-2011.03 and manually delete all rake-0.9 files (gems, specifications are the ones that count I believe).

I ran into this same problem (needed rake 0.8.7 but got 0.9.0 "for free" with rvm). Initially gem list -d rake gave the following output:
rake (0.9.0, 0.8.7)
Installed at (0.9.0): ~/.rvm/gems/ruby-1.9.2-p136#global
(0.8.7): ~/.rvm/gems/ruby-1.9.2-p136#my_gemset
Switching to the global gemset with rvm use #global gave me this output:
rake (0.9.0)
Installed at: ~/.rvm/gems/ruby-1.9.2-p136#global
So I just did gem uninstall rake. Now, switching back to my gemset with rvm use #my_gemset the correct version of rake (0.8.7) is being used.

If you're using bundler, you should read this excellent article by Yehuda Katz. Following his instructions means you don't have to uninstall rake 0.9.0. Try following command:
bundle exec rake --version
Prepending bundle exec will make sure that only the correct version of the rake is loaded, regardless of others you have installed.

Did you try using the 'gem cleanup' script ?

Related

Ruby on rails error when running rails s

Um quite new to rails and um getting an error when run the command
rails s
it says
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I run bundle install nothing happened
my gem list has rake 0.9.2.2
what can go wrong?
my ruby version is 1.9.3
Thank you in advance
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
When you use command gem list, you will get a list of gem installed on your machine.
For example : rake (10.0.4, 10.0.3, 0.9.2.2)
Just see the console which gem is compatible with your application. It is already mentioned in the error log message.
Use
gem uninstall rake
Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s
Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]

capistrano and assets:precompile not working due to rake versioning issue

I get the following error on a capistrano deploy:
If I run that commmand from the command line, I get the following:
You have already activated rake 0.9.2, but your Gemfile requires rake 10.0.3. Using bundle exec may solve this.
From my Gemfile
gem 'rake', '10.0.3'
When I look at Gemfile.lock, I see only three mentions of rake:
railties (3.1.10)
rake (>= 0.8.7)
rake (10.0.3)
rake (= 10.0.3)
This seems like fixing it at 10.0.3 should be fine.
Why am I getting this and how do I resolve this? What would happen if I ran gem uninstall rake? Would Capistrano still work after that?
thx in advance
edit 1
different rake versions:
root#curren:/data/sites/domain.com/apps/app-rails/current# rake -V
rake, version 0.9.2
root#curren:/data/sites/domain.com/apps/app-rails/current# bundle exec rake -V
rake, version 10.0.3
For Cap 3:
SSHKit.config.command_map[:rake] = "bundle exec rake"
If there is no reason not to update rake, you can run
bundle update rake
This will actually update your Gemfile.lock to use the newest version of rake
if you want to keep rake 0.9.2 uninstall the newest
gem uninstall rake
#result on my box
Select gem to uninstall:
1. rake-0.8.7
2. rake-10.0.1
3. rake-10.0.2
4. All versions
This Yehuda Katz blog post explains more.

Need to uninstall rake 0.9.2.2 and install rake 0.8.7

I built a new clean VM, install rvm, and installed ruby 1.9.2 and ran gem install rails --version '=3.0.7'. So far so good. When I did gem list rake, I saw that rake 0.9.2.2 was installed and I need rake 0.8.7. I read up on uninstalling rake. Then installed gem install rake -v='0.8.7'. This is what I did and observed:
gem list rake
rake (0.9.2.2, 0.8.7)
gem uninstall rake 0.9.2.2
You have requested to uninstall the gem rake-0.8.7
.......
Continue [Yn]
Successfully unistalled rake 0.8.7
INFO: gem "0.9.2.2" is not installed
gem list rake
rake (0.9.2.2)
Ok so it shows both versons of rake installed at first, I specify to delete 0.9.2.2 and it says its uninstalling 0.8.7 and that it completed uninstalling 0.8.7. (Not what I entered) At the end it shows 0.9.2.2 still installed in gem list rake. I have gone through this iteration multiple times, same result every time.
In the end, I need Ruby 1.9.2; rails 3.0.7 and rake 0.8.7. The first two I have fine. But how do I get rake back to 0.8.7? Or is what I see just some trash left over in some inventory of gems and does not reflect reality? or can you be sure what you really have?
Thanks in advance.
Try using the following command
rvm use #global && gem uninstall rake
I was having this same issue with the predefined constatnts 'Ruby' & 'LN_SUPPORTED'.
However; my 'gem list' only was showing rake 0.9.2.2. So after I was able to install 0.8.7, everything started working again.
sudo gem install rake -v=0.8.7
Can you do a: sudo gem uninstall Rake without specifying a version to get rid of rake completely before trying to reinstall both versions? Or possibly (I know it's frowned upon, but... ) remove the rake gem folder?
Also, maybe you could add rake (0.9.2.2, 0.8.7) to your gemfile and then do a bundle update
This works for me:
gem uninstall rake --version 0.9.2.2

How to overcome Bundle resolve conflict when running specs

I just added rspec but get a bundler conflict when I try and run the specs, this does not happen if I run rake tasks or start the server.
bundle exec spec
/<snip>/gems/bundler-1.0.21/lib/bundler/resolver.rb:280:in `resolve': You have requested: (Bundler::GemNotFound)
nokogiri >= 0
The bundle currently has nokogiri locked at 1.5.0.
Try running `bundle update nokogiri`
I've tried running bundle update nokogiri and removing Gemfile.lock and rerunning bundle install. I've even tried rvm gemset empty and starting afresh.
Gemfile: https://gist.github.com/1342979
Gemfile.lock: https://gist.github.com/1342981
JRuby: 1.6.2
Rails: 3.0.10
Bundler: 1.0.21
It seems running rspec instead of spec works...

Bundle Update stuck at "Fetching source index for http://rubygems.org/"

As of yesterday, I'm unable to update my bundle. It gets stuck at "Fetching source index for http://rubygems.org/". I know this usually takes a while, but I've waited for hours and tried several times over the last day. I have a 20 Mbit internet connection.
I'm using gem 1.8.5, Bundler version 1.0.15, rvm 0.1.46, ruby-1.9.2-p0 [ x86_64 ] and Rails 3.0.8 on a Macbook. Gemfile: https://gist.github.com/1028832
The reason I'm trying to run Bundle Update is because the bundle was set to rake 0.8.7 until recently (not sure why), but rake started demanding that I move up to 0.9.2. So I changed the Gemfile. Bundle Install tells me to:
bundle install
Fetching source index for http://rubygems.org/
You have requested:
rake >= 0.9.2
The bundle currently has rake locked at 0.8.7.
Try running `bundle update rake`
My .bundle/config contains:
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
BUNDLE_WITHOUT: production
I'm not behind a proxy.
I even tried deleting Gemfile.lock, reinstalling the ruby version in rvm and deleting all gems:
rm Gemfile.lock
rvm uninstall 1.9.2
rvm install 1.9.2
for x in `gem list --no-versions`;do gem uninstall $x -aIx;done
gem install bundle
bundle install
Comment out all gems and set explicit versions for rails (e.g. 3.0.8) and rake (e.g. 0.9.2). Then just run rake, cucumber and the server to see which gems you really need and add them back one by one manually.
I had the same problem with jam at “Fetching source index for http://rubygems.org/”
In my case it was solved by using the rubygems modern index instead of the API endpoint:
bundle install --full-index
I checked the Gemfile.lock and added the specific version (e.g. ~> 1.3.0) to the gems that had none in the Gemfile. Found out to be faster, than uncommenting gem by gem.
By doing the accepted answer and uncommenting gem by gem, I found that the error was due to incompatible gem dependencies. Maybe the resolution algorithm was stuck in a loop.

Resources