user1868185
user1868185

Reputation: 899

rake or any other rake command not working properly

Hi i was doing some coding and tried to

rake routes

and this error message came up out and i dont know what to do

rake aborted!
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.4.0. Prepending `bundle exec` to your command may solve this.

/home/simplybel/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.4/lib/bundler/runtime.rb:34:in `block in setup'
/home/simplybel/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.4/lib/bundler/runtime.rb:19:in `setup'
/home/simplybel/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.4/lib/bundler.rb:121:in `setup'
/home/simplybel/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.4/lib/bundler/setup.rb:7:in `<top (required)>'
/home/simplybel/projects/gamification/config/boot.rb:4:in `<top (required)>'
/home/simplybel/projects/gamification/config/application.rb:1:in `<top (required)>'
/home/simplybel/projects/gamification/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/simplybel/projects/gamification/config/boot.rb:4:in `<top (required)>'
/home/simplybel/projects/gamification/config/application.rb:1:in `<top (required)>'
/home/simplybel/projects/gamification/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

any help with this would really be appreciated

Upvotes: 14

Views: 19325

Answers (10)

Zakaria Acharki
Zakaria Acharki

Reputation: 67505

You can remove the older version of the gem by using :

gem uninstall rake --version=[Here version that you want to delete]

After uninstall just use rake routes normally.

Upvotes: 2

cibinlik
cibinlik

Reputation: 55

There were two answers for me:

  1. Temporary solution:

bundle exec rake routes

  1. Permanent Solution

gem update rake and then rake routes

Upvotes: -1

blb
blb

Reputation: 41

If you need to use older version just remove newer version:

gem uninstall rake --version=<newer version>

In your case:

gem uninstall rake --version=10.4.2

Upvotes: 3

MCB
MCB

Reputation: 2073

You generally shouldn't manually edit gemfile.lock. And if you do delete the file and restart from scratch make sure the versions of you gems in your gemfile are specified so you'll get the ones back that you expect. For this situation:

$ bundle update rake

worked for me.

Upvotes: 20

Chance Hines
Chance Hines

Reputation: 21

  1. manually delete you gemfile.lock file
  2. run bundle install

That fixed the problem for me.

Upvotes: 2

M&#225;rio Vieira
M&#225;rio Vieira

Reputation: 1

The command

bundle exec rake routes 

makes it work, but it's way better if you pick the right version of rake needed and change it in your Gemfile.lock

Upvotes: 0

Luis Tellez
Luis Tellez

Reputation: 2973

You probably want to update your gemfile.lock and change the version of rake from 10.4.0 to 10.4.2 an you can continue working as you were before this problem.

Upvotes: 0

Sean Foreman
Sean Foreman

Reputation: 31

I just ran into this issue today. I used RubyMine to build a new project and it installed rake 10.4.2. For my work I have to use 10.3.2 for db:migrate.

RubyMine solution: To fix the problem in RubyMine I opened opened up the run configuration for db:migrate, went to the Bundler tab and checked "Run the script in context of the bundle (bundle exec)"

Upvotes: 3

Eric
Eric

Reputation: 3792

I got this problem on an old project after running the command rails new MyNewProject

To fix it on the old project I just went into the Gemfile.lock file and searched for rake. The I found rake (10.3.2) and replaced it with rake (10.4.2) and that fixed it for me.

Upvotes: 27

rderoldan1
rderoldan1

Reputation: 4078

This error is because your gem file is using a different version of rake, so you need to specify which of the rake versions you need, so this can help you

 bundle exec rake routes

Upvotes: 8

Related Questions