Search code examples
ruby-on-railsruby-on-rails-3rakegemfile

Why does my environment require I run bundle exec?


Whenever I run a rake command (i.e. rake routes) I get this error:

You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.

If I run bundle exec rake routes it works.

I want to be able to simply rake routes without having to run bundle exec rake routes.

I've looked at other questions with similar errors and tried the various solutions (like running bundle update) to no avail.

Also, in my gemfile I specified gem 'rake', '0.9.2'

Any suggestions?


Solution

  • Try to execute:

    gem list
    

    You'll probably see a couple of version installed for rake. By the way, bundle exec is the right way of executing your code in the context of a Rails application. So, you can use an alias for typing less.