简体   繁体   中英

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)

尝试运行bundle exec rake routes以确保正确版本的Rake被加载。

您需要将gem更新为最新的可用版本: bundle update

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM