繁体   English   中英

警告:Bundler 的运行版本比创建锁文件错误的版本旧

[英]Warning: the running version of Bundler is older than the version that created the lockfile error

当我开发/测试时,我的控制台中不断出现此错误

Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.

它根本没有阻止我,而是困扰着我。 我知道最简单的解决方案就是将我的 Gemfile.lock 更新为此。

BUNDLED WITH
   2.1.2

但我想永久解决这个问题。 我试着

gem uninstall bundler

接着

gem install bundler -v 2.1.4

它让我一直给出这个错误

Gem bundler-2.1.2 cannot be uninstalled because it is a default gem

当我尝试先安装 2.1.4 然后删除 bundler 2.1.2 时,控制台给了我这个输出。

Gem bundler-2.1.2 cannot be uninstalled because it is a default gem
Successfully uninstalled bundler-2.1.4

这个问题有什么解决办法吗? 提前致谢

根据 Anne van Rossum,gem update --system 为我解决了这个问题。

只需运行gem install bundler:2.1.4 ,不用担心 ruby​​ 自带的旧版本,不应该使用它。

我修好了它!。 如果您使用的是 rvm,那么您必须转到您在该特定项目上使用的 ruby​​ 版本(例如,'rvm use 2.7.0'),然后运行'gem update --system'

您需要执行以下操作以确保将正确的默认版本的 Bundler 用于您正在使用的存储库。

  1. 您可以运行以下命令,但这可能会出现问题,因为它会破坏您系统上的本地 gem,因为它们都已更新。

     gem update --system
  2. 以下方法是确保更新 Bundler 的更安全的方法

  • 获取您的 gem 环境并记下INSTALLATION_DIRECTORY
     gem environment
  • 然后运行以下
    cd <INSTALLATION DIRECTORY>/specifications/default rm bundler-<old_default_version>.gemspec gem install --default bundler -v <new_default_version>
  1. 如果您已遵循 2 并且仍然无法正常工作,请运行
    gem install bundler:<new_default_version>
    确保您的本地仓库使用正确的版本

另一种选择是更新到最新版本:

gem update bundler

除非有使用旧版本的特定原因(例如,最新版本中存在错误,或者它们不再兼容),否则您可以按照警告消息安装该特定版本:

警告:Bundler (2.2.32) 的运行版本比创建锁定文件的版本 (2.3.4) 旧。 我们建议您通过运行gem install bundler:2.3.4升级到创建锁定文件的版本。

gem install bundler:2.3.4

就我而言,这是安装失败时显示的唯一错误消息。 我浪费了很多时间试图修复它,但事实证明这只是一个警告,而不是阻止安装的实际错误。

要查看实际的错误消息,我必须运行bundle install --verbose

Ruby 附带一组默认的 gem。 捆绑器就是其中之一。 Ruby 附带的默认捆绑器版本很快就会过时。 要更新您的标准 gem,请运行

gem update --system

有关更多信息,请参阅RubyGems命令参考

如果你不想更新你的标准 gem,你也可以在你的包 ( Gemfile.lock ) 的上下文中更新Bundler Bundler v1.14 开始,这是可能的。

bundle update --bundler

Bundler v2.3.5 (2022 年 1 月)以来,此警告的时间应该已经结束。 它现在自动获取匹配的远程版本并安装它。

Bundler 2.3.17 is running, but your lockfile was generated with 2.3.7. Installing Bundler 2.3.7 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.3.7
Installing bundler 2.3.7
…

我删除了 gemfile.lock 文件,然后再次捆绑以构建新的依赖项。

https://github.com/rubygems/rubygems/issues/3202

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM