rake aborted! You have already activated rake 10.0

2019-03-09 01:45发布

I am trying to do "rake db:migrate" and it is giving me this error.

Andy:AcademyAir Andy$ rake db:migrate
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr in PATH, mode 040777
rake aborted!
You have already activated rake 10.0.2, but your Gemfile requires rake 0.9.2.2. Using bundle exec may solve this.
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `block in setup'
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup'
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup'
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/Andy/Desktop/AcademyAir/config/boot.rb:6:in `<top (required)>'
/Users/Andy/Desktop/AcademyAir/config/application.rb:1:in `<top (required)>'
/Users/Andy/Desktop/AcademyAir/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

8条回答
时光不老,我们不散
2楼-- · 2019-03-09 01:52

I was able to solve this by opening up Gemfile and changing gem 'rake', '~> 0.9.2.2' to gem 'rake', '~> 10.0.1'

查看更多
再贱就再见
3楼-- · 2019-03-09 01:52

change the version which located both in the gemfile and gemlock to the version number shown in the console, it will be done

查看更多
Animai°情兽
4楼-- · 2019-03-09 01:57

Solved the same issue by running:

bundle update

This will update your rake gem to the latest version and allow you to run the migration.

If you are using a gemset: be sure to run bundle install after you've updated rake to update your local gemset as well.

查看更多
forever°为你锁心
5楼-- · 2019-03-09 01:58

In your Gemfile, explicitly set the latest rake version by:

gem 'rake', '~> 10.0.1'

And then run

$ bundle update rake

Then try

查看更多
爷、活的狠高调
6楼-- · 2019-03-09 01:58

I've just ran into the same problem.

  1. I inserted in my gemfilen gem 'rake', '~> 10.0.1' [in your case it should be '10.0.2']
  2. I deleted my gemfile lock
  3. I ran rake db:migration again and it worked.

I got this tip here: Activated Ruby RAKE 10.0.1, require 10.0.0

Update: In my case I didn't have rake duplicated. I just have in my gems the 10.0.1 version.

查看更多
老娘就宠你
7楼-- · 2019-03-09 02:04

It happens because you are using rake from the system. (latest version by default) The solution is use follow command:

bundle exec rake db:migrate

Also, you can create alias. Because this command is too big and difficult to write.

echo "alias be='bundle exec'" >> ~/.bash_profile
source ~/.bash_profile

Then you can use follow short command:

be rake db:migrate
查看更多
登录 后发表回答