You have already activated X, but your Gemfile requires Y

前端 未结 8 2549
逝去的感伤
逝去的感伤 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:30

    Using bundle exec is the right way to do this.

    Basically what's happening is that you've updated rake to 0.9.2 which now conflicts with the version specified in your Gemfile. Previously the latest version of rake you had matched the version in your Gemfile, so you didn't get any warning when simply using rake.

    Yehuda Katz (one of the original Bundler developers) explains it all in this blog post.

    To avoid typing bundle exec ... all the time, you could set up an alias or function in your shell for commands you commonly use with Bundler. For example this is what I use for Rake:

    $ type bake
    bake is a function
    bake () 
    { 
        bundle exec rake "$@"
    }
    

提交回复
热议问题