How do you activate or set the default rake?

I've seen a lot

You have already activated rake 0.9.x, but your Gemfile requires rake 0.xx 

mistakes.

Of course, they can be solved (temporarily or always) using some methods, such as:

 bundle exec rake 

The method above works, but you always need to type bundle exec.

It can also be solved with

 bundle update 

But updating the package also updates your other gems.

Some say this can be solved with

 gem uninstall unwanted_rake_version 

Yes, an unwanted rake may be set, but it is still marked as activated, thereby still giving an error.

One solution would be to explicitly specify the rake version in your Gemfile, but that is not a question. It is about how to install the standard version of rake or activate this specific version in rvm or other types of ruby ​​installations?

+8
ruby rake rvm bundler
source share
3 answers

Newer versions of rake can be activated by providing an optional first argument, that is, the gem version.

$ rake 0.9.2

Alternatively, if you have an earlier version of the rake installed, you can manually update the rake script to enable this option (or specify any version you need).

A rake script usually lives in / usr / bin / rake (or ~ / .rvm / gems / ruby ​​- # {ruby-name} / rake when using rvm). And dictates the version of their pearl to load before parsing parameters.

On my system, this is similar.

 $ 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) 

An important bit of gem 'rake', version change version will force rake to use a specific version system / rvm wide.

For more information, Katz's article perfectly explains how binary files run under rubygems

+8
source share

When I get this error, it is usually the result of work between projects depending on different versions of rake. Easy fix

 gem uninstall rake 

And then in your project directory (assuming you're working with the Bundler) just

 bundle 
+3
source share

I always delete the rake first, a command like this:

 gem uninstall rake -v=version 

then install another version

 gem install rake -v=version 
-one
source share

All Articles