新手问题 我今天才知道 bundle update 不一定得到最新版本

Rei · 2013年05月16日 · 最后由 reducm 回复于 2013年07月08日 · 3989 次阅读

比如在 Gemfile 写了

gem 'slim'

目前最新版是 1.3.8,那么 bundle 之后得到的版本有可能是 1.0.1。要确保自己需要的版本,就要写

gem 'slim', '~> 1.3.8'

https://github.com/carlhuda/bundler/issues/2474 https://github.com/carlhuda/bundler/issues/1266

因为 bundler 设计为解决依赖问题,而不是解决更新问题。

bundle satisfy 在语义上就正确了...

alias bs='bundle update'

哈...之前写 railsgirls 那网站的时候 我也遇到这个坑了...bundle update 之后好好的程序跑不了了,发现 slim 被降级掉 - -

If you run bundle update with no parameters, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources.

http://gembundler.com/v1.3/bundle_update.html

这咋回事。

To do this, run bundle update, which will ignore the Gemfile.lock, and resolve all the dependencies again. Keep in mind that this process can result in a significantly different set of the 25 gems, based on the requirements of new gems that the gem authors released since the last time you ran bundle update.

我觉得我没理解错啊,update 不是升级到满足依赖的最新版的意思吗?

表示中招 >_<

啊,这个坑我也掉进去过。以后 Gemfile 里面还是得写好版本号啊。

一般是跑完 bundle update 后有冲突或跑不过测试再去解决,此时再填上确切版本 (or git repo),这样一直下来也没遇到多大问题啊...难道是自己用得 Gem 太少...

需要 登录 后方可回复, 如果你还没有账号请 注册新账号