Providing the `bundle exec` of your command can solve this problem

I am having a problem deploying my site to AWS .

 Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this. /var/app/ondeck/config/boot.rb:3:in `<top (required)>' /var/app/ondeck/config/application.rb:1:in `<top (required)>' /var/app/ondeck/Rakefile:4:in `<top (required)>' LoadError: cannot load such file -- bundler/setup /var/app/ondeck/config/boot.rb:3:in `<top (required)>' /var/app/ondeck/config/application.rb:1:in `<top (required)>' /var/app/ondeck/Rakefile:4:in `<top (required)>' (See full trace by running task with --trace) (ElasticBeanstalk::ExternalInvocationError) 

and when I do a gem list rake , it gives me

 *** LOCAL GEMS *** airbrake (4.3.1) rake (10.5.0, 10.4.2) 

I want to have only one version, when I do bundle exec gem uninstall rake -v 10.4.2 , it gives me

 ERROR: While executing gem ... (Gem::InstallError) gem "rake" cannot be uninstalled because it is a default gem 

How to solve this problem? Any help would be appreciated.

+8
ruby ruby-on-rails rubygems bundler
source share
2 answers

You need to prefix your command with bundle exec . For example, if your rake team

 rake deploy 

You should use instead

 bundle exec rake deploy 

The bundler will get the correct gem versions listed in your Gemfile and execute the command.

+9
source share

Start the batch upgrade rake first.

I hope this works for you.

+24
source share

All Articles