Rails: You have already activated rake 10.3.1, but your Gemfile requires rake 10.2.2 (Gem::LoadError)

后端 未结 15 1918
自闭症患者
自闭症患者 2020-12-05 02:21

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 yo         


        
15条回答
  •  悲&欢浪女
    2020-12-05 02:39

    My error message:

    ~ $ rake db:migrate                                                                                                                                                                            [2.6.5][10:21:00]
    rake aborted!
    Gem::LoadError: You have already activated rake 12.3.2, but your Gemfile requires rake 13.0.1. Prepending `bundle exec` to your command may solve this.
    /Users/torvalds/workspace/ekohe/whitespace/config/boot.rb:5:in `'
    /Users/torvalds/workspace/ekohe/whitespace/config/application.rb:3:in `require_relative'
    /Users/torvalds/workspace/ekohe/whitespace/config/application.rb:3:in `'
    /Users/torvalds/workspace/ekohe/whitespace/Rakefile:6:in `require_relative'
    /Users/torvalds/workspace/ekohe/whitespace/Rakefile:6:in `'
    (See full trace by running task with --trace)
    

    I am using the rbenv to manage my Ruby environment.

    My global Ruby version is as know as the default Ruby version is 2.7.1, because I set it as rbenv global 2.7.1. However, my rake under Ruby 2.7.1 is 12.3.2

    ~ $ rake --version
    
    rake, version 12.3.2
    

    My project Ruby version is 2.6.5. however, my rake under Ruby 2.6.5 in my project is 13.0.1

    ~ $ bundle exec rake --version
    
    rake, version 13.0.1
    

    so I have to uninstall global rake

    ~ $ gem uninstall rake
    

    and reinstall it back

    ~ $ gem install rake
    
    Fetching rake-13.0.1.gem
    Successfully installed rake-13.0.1
    1 gem installed
    

    it works! ~~~

    I'm not sure whether it will have an influence on other projects. However, so far it works.

提交回复
热议问题