Rake Routes Command Is Not Working

Rake Routes Command Is Not Working

I have run this rake routes command in terminal but not working, But it's working few days back. Please check it

jaskaran@jaskaran-Vostro-1550:~/rails_project$ rake routes
rake aborted!
Gem::LoadError: You have already activated rake 10.3.2, but your Gemfile requires rake 10.2.2. Prepending `bundle exec` to your command may solve this.
/home/jaskaran/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:34:in `block in setup'
/home/jaskaran/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:19:in `setup'
/home/jaskaran/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler.rb:120:in `setup'
/home/jaskaran/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/setup.rb:7:in `<top (required)>'
/home/jaskaran/rails_project/config/boot.rb:4:in `<top (required)>'
/home/jaskaran/rails_project/config/application.rb:1:in `<top (required)>'
/home/jaskaran/rails_project/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/jaskaran/rails_project/config/boot.rb:4:in `<top (required)>'
/home/jaskaran/rails_project/config/application.rb:1:in `<top (required)>'
/home/jaskaran/rails_project/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
8

4 Answers

Try running bundle exec rake routes to ensure the proper version of Rake gets loaded.

You need to update your gems to the latest available versions: bundle update

1

Rake versions seems to be different. So, run it as bundle exec rake routes. It should be working.

The correct solution to your problem is to use bundle exec, as suggested by others, to load the version of Rake which your app expects. You may also wish to avoid needing to always run Rake commands with bundle exec. You can either

1) [Recommended] Update your app to use the same version of rake as you have running globally (10.3.2, which is the latest version)

or

2) [Not really recommended] Uninstall version 10.3.2 (actually, any version greater than the one you want) from your global gems and install version 10.2.2 (which your app is currently using)

rvm @global do gem uninstall rake
rvm @global do gem install rake --version 10.2.2

See RVM documentation for global gemsets

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.