ruby-on-rails-4 - 为什么 "gem install bundler"不升级我的 bundle 程序?

标签 ruby-on-rails-4 upgrade bundler ruby-on-rails-6 gemfile

我正在尝试从 Rails 4.2 升级到 Rails 6。我的 Gemfile 中有这个

fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
source 'https://rubygems.org'
ruby '~> 2.6.7'

gem 'rails', '~> 6.0.0'

当我安装时,我遇到了失败

$ bundle install

[!] There was an error parsing `Gemfile`: run 'gem install bundler' to update your bundler version. Bundler cannot continue.

 #  from /Users/davea/workspace/my-app/Gemfile:1
 #  -------------------------------------------
 >  fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
 #  source 'https://rubygems.org'
 #  -------------------------------------------

所以我想升级bundler,然后运行

$ gem install bundler
Successfully installed bundler-2.2.31
Parsing documentation for bundler-2.2.31
Done installing documentation for bundler after 2 seconds
1 gem installed

但这似乎并没有升级任何东西。我仍然遇到同样的错误

$ bundle install

[!] There was an error parsing `Gemfile`: run 'gem install bundler' to update your bundler version. Bundler cannot continue.

 #  from /Users/davea/workspace/my-app/Gemfile:1
 #  -------------------------------------------
 >  fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
 #  source 'https://rubygems.org'
 #  -------------------------------------------

该版本似乎仍然停留在旧版本

$ bundle -v
Bundler version 1.17.3

$ bin/bundle -v
Bundler version 1.17.3

即使是运行

$ gem update bundler
Updating installed gems
Nothing to update

没有帮助。如何升级我的 bundle 程序?

最佳答案

检查您的 Gemfile 条目版本并确保 Gemfile.lock 在您的版本控制中,然后:

bundle update --bundler

关于ruby-on-rails-4 - 为什么 "gem install bundler"不升级我的 bundle 程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69903372/

相关文章:

python - pip install -U setuptools 使 windows 10 失败

NDK 从 20.1 升级到 21.0 后 Android 应用崩溃

c# - 区分卸载/安装和升级应用程序

bundler - 包裹构建错误 : plugin is not a function

ruby - bundle 成功但未加载所有 gem

ruby-on-rails - rake 分贝 :seed is not working using neo4j gem

ruby-on-rails - Rails + X-Sendfile 向 Ipad 提供大型视频

ruby-on-rails - Ruby On Rails:NameError:未初始化常量 Timezone::Configure

ruby-on-rails - Rails ActiveRecord : Pluck from multiple tables with same column name

ruby-on-rails - 邪恶的使用内部命名空间