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

后端 未结 15 1771
自闭症患者
自闭症患者 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:47

    I had a similar issue and I was skeptical about removing a line from my Gemfile.lock, it seemed hacky and the inconvenience of prepend bundle exec to every rake command was not an option either. I fixed this by first going into my Gemfile.lock to see what version of rake was there (in my case it was 11.1.2). My thought was to uninstall rake and install this version. Running gem uninstall rake gave this output:

    Select gem to uninstall:

    1. rake-10.5.0
    2. rake-11.1.1
    3. rake-11.1.2
    4. rake-11.2.2
    5. rake-11.3.0
    6. All versions

    I uninstalled both rake-11.2.2 and rake-11.3.0. That fixed my problem

    0 讨论(0)
  • 2020-12-05 02:49

    I tried another way which is delete Gemfile.lock then run bundle install. After that I run rake db:migrate. And everything works fine.

    Although I don't think remove Gemfile.lock is bad practice, but may be; who know.

    0 讨论(0)
  • 2020-12-05 02:50

    Try to install nodejs, this was solved my problem.

    If you're on ubuntu run this command.

    sudo apt-get install nodejs
    
    0 讨论(0)
提交回复
热议问题