Use older version of Rake
You can specify the version of Rake to use, in your Gemfile:
gem 'rake', '0.8.7'
Though the "error" message you are getting says it all... you need to run:
bundle exec rake ...
... in order to use the right rake to run your rake tasks.
More info on bundle exec
: http://gembundler.com/man/bundle-exec.1.html
Cannot Install Older Version of Rake Gem in Rails
Run this command on the bash:
gem uninstall rake
Then you will be asked which version you want to remove. You select 0.9.2 and then you run
bundle update rake
This should do it for you...
How to run a specific version of rake
This may be of help. Have you tried the underscore solution?
Example:
rake _0.9.2_
how do you activate or set the default rake?
The newer versions of rake can be activated by supplying an optional first argument, that is the gem version.
$ rake 0.9.2
Alternatively, if you have an older version of rake you can update the rake script manually to include this parameter (or specify any specific version you want).
The rake script usually lives in /usr/bin/rake (or ~/.rvm/gems/ruby-#{ruby-name}/rake if using rvm). And dictates the version of them gem to load before parsing paramaters.
It looks like this on my system.
$ cat ~/.rvm/gems/ruby-1.9.2-p180/bin/rake
#!/home/tomcat/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'rake', version
load Gem.bin_path('rake', 'rake', version)
The important bit is gem 'rake', version
changing version
will force rake to a specific version system/rvm wide.
For more info, Katz' article explains nicely how binaries run under rubygems
downgrading rake version from 10.1.1 to 10.1.0
Actually,
gem uninstall rake -v 10.1.1
and then
bundle install
Works for me. Thanks Ju Liu.
You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7
I thank to Dobry Den, cheers dude. but little more I had to do.
here is solution (works for me).
I had added
gem 'rake','0.8.7'
on Gemfile, which was not there, but my new version of rails automatically install rake(0.9.0).
after I had delete rake0.9.0 by gem uninstall rake
and after doing bundle update rake
, I can create and migrate database.
Rake at wrong version despite fresh uninstall/install procedures
I was able to fix this strange issue by following these steps:
gem uninstall rake
Then
bundle update rake
This gave me the response that rake is already up-to-date, but still, i list it here - just in case.
Then
gem install rake -v=0.8.7
Furthermore in my Gemfile i had this configuration
source 'http://rubygems.org'
gem 'rails', '3.2.6'
gem 'rake', '0.8.7'
(In that order)
After doing all this i was able to run
rake generate_secret_token
successfully.
You have already activated rake 0.9.6, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this
At the root of project, do:
gem list rake
You will see probably more than one version. If so, then remove the version you don't need (i.e. 0.9.6) by command:
gem uninstall rake
it will ask which version to remove. Or try doing
bundle update rake
Related Topics
Error Install Rubyracer with Error "Invalid Gem: Package Is Corrupt"
Rails Server Cannot Start; Getaddrinfo: Nodename Nor Servname Provided, or Not Known (Socketerror)
How to Mark a Cucumber Scenario as Pending
How to Strip Leading and Trailing Quote from String, in Ruby
Rspec: Should Be (This or That)
How to Convert Boolean Values to Integers
Ruby Inside JavaScript Block [Slim Template]
What Is Difference Between "P" and "Pp"
Rails 5 Db Migration: How to Fix Activerecord::Concurrentmigrationerror
How to Reset a Factory_Girl Sequence
Prefer %W(...) to a Literal Array
How to Give a Sub-Module the Same Name as a Top-Level Class
Are There Primitive Types in Ruby
Command for Displaying a Gem's Dependencies