我正在尝试从 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/