Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 661
user1868185 Avatar asked Dec 04 '14 14:12

user1868185


People also ask

How do you call a rake task?

Go to Websites & Domains and click Ruby. After gems installation you can try to run a Rake task by clicking Run rake task. In the opened dialog, you can provide some parameters and click OK - this will be equivalent to running the rake utility with the specified parameters in the command line.

What are Rake tasks used for?

Rake is a popular task runner for Ruby and Rails applications. For example, Rails provides the predefined Rake tasks for creating databases, running migrations, and performing tests. You can also create custom tasks to automate specific actions - run code analysis tools, backup databases, and so on.


Video Answer


2 Answers

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.

like image 146
Eric Avatar answered Oct 15 '22 01:10

Eric


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.

like image 22
MCB Avatar answered Oct 15 '22 01:10

MCB