rake aborted! You have already activated rake 10.0.2, but your Gemfile requires rake 0.9.2.2

前端 未结 8 787
终归单人心
终归单人心 2021-01-31 17:33

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.         


        
相关标签:
8条回答
  • 2021-01-31 18:00

    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.

    0 讨论(0)
  • 2021-01-31 18:08

    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
    
    0 讨论(0)
  • 2021-01-31 18:13

    Try this bundle exec rake db:migrate

    Remove rake 10.0.2 gem

    By using gem uninstall rake and remove 10.0.2 version of rake gem

    And Then Try rake db:migrate

    Why Error comes : In you gem list two version (10.0.2 and 0.9.2.2) of rake gem install so that this error comes.*

    Another Solution is you can do bundle update

    0 讨论(0)
  • 2021-01-31 18:14

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

    gem 'rake', '~> 10.0.1'
    

    And then run

    $ bundle update rake
    

    Then try

    0 讨论(0)
  • 2021-01-31 18:16

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

    0 讨论(0)
  • 2021-01-31 18:19

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

    0 讨论(0)
提交回复
热议问题