You have already activated X, but your Gemfile requires Y

前端 未结 8 2503
逝去的感伤
逝去的感伤 2020-11-27 10:43

When running rake I get this error:

You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle ex

相关标签:
8条回答
  • 2020-11-27 11:33

    bundle exec is correct, but you don't want to be typing it every time.

    You can put this in your .bashrc:

    # Automatically invoke bundler for rake, if necessary.
    rake() { if [ -e ./Gemfile.lock ]; then bundle exec rake "$@"; else /usr/bin/env rake "$@"; fi; }
    
    0 讨论(0)
  • 2020-11-27 11:36

    Last time that this happened to me, I had updated all my gems. I did a gem uninstall rake and it listed version options. I picked the newer one, and then I did not have to use bundle exec anymore.

    Basically, if you use bundle exec it uses whatever gem version is in installed by your bundle, so what is in the Gemfile. Without bundle exec it uses whatever version is your system default.

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