Already activated rake version different than what

2019-01-13 20:33发布

Here is my error:

rake aborted!
Gem::LoadError: You have already activated rake 10.3.1, but your Gemfile requires rake 10.2.2. Prepending `bundle exec` to your command may solve this.
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:34:in `block in setup'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:19:in `setup'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
/Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/boot.rb:4:in `<top (required)>'
/Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/application.rb:1:in `<top (required)>'
/Users/AaronWilliamson/Desktop/Ripelist-Classifieds/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/boot.rb:4:in `<top (required)>'
/Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/application.rb:1:in `<top (required)>'
/Users/AaronWilliamson/Desktop/Ripelist-Classifieds/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

I can't run any rake tasks and this seems to be the root of all my other problems. It wasn't like this a couple days ago when I was running rake commands. Can anyone explain what's going on here and how to get my app back on track? I've hit a wall. Also, bundle exec doesn't fix the root of the problem for me. I never had to do that in the past and it's still not working now.

13条回答
【Aperson】
2楼-- · 2019-01-13 21:03

Go in the Gemfile.lock, find the rake file and update the version there.

I got this error:

Gem::LoadError: You have already activated rake 11.2.2, but your Gemfile requires rake 11.1.2. Prepending bundle exec to your command may solve this.

What I did was to change the version of rake in the Gemfile.lock from: rake (11.1.2) to rake (11.2.2).

Everything worked fine after that.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-01-13 21:07

Type this command:

bundle update rake
查看更多
一夜七次
4楼-- · 2019-01-13 21:08

bundle update rake works for me as well.

My error was Gem::LoadError: You have already activated rake 12.3.1, but your Gemfile requires rake 12.3.0. Prependingbundle execto your command may solve this.

查看更多
时光不老,我们不散
5楼-- · 2019-01-13 21:12

I meet the similar problem. My solution is change the line of rake version "gem 'rake', '~> 10.3'" in file Gemfile, delete Gemfile.lock and run 'bundler install', the new Gemfile.lock will show the new version 10.3.1. Then everything will be fine.

查看更多
祖国的老花朵
6楼-- · 2019-01-13 21:18

As mentioned on earlier answers this is a simple issue which happens when your gemset has a rake version that is newer than the version number your Gemfile.lock mentions.

The easiest way to debug this is to run bundle update.

The other ways could be to remove Gemfile.lock and running bundle install or simply deleting the line in Gemfile.lock that corresponds to the rake version and try bundle install. But this might sometimes corrupt the Gemfile. I would prefer the first method because it is the safest and the easiest.

查看更多
爷、活的狠高调
7楼-- · 2019-01-13 21:19

According to this solution (that worked for me) : https://stackoverflow.com/a/23668399/4260090

You can solve it by using rubygems-bundler

Type these commands in your terminal :

$ gem install rubygems-bundler
$ gem regenerate_binstubs

It should work now

查看更多
登录 后发表回答