ruby-on-rails - Rails 升级抱怨旧的捆绑器版本
问题描述
我想从 Rails 4.2 升级到 6。我已经更新了我的 Gemfile 以包含
fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
source 'https://rubygems.org'
ruby '~> 2.7.1'
gem 'rails', '~> 6.0.0'
但是尝试升级 rails gem 会导致
$ bundle update rails
Traceback (most recent call last):
4: from /Users/myusername/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:22:in `<main>'
3: from /Users/myusername/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:22:in `eval'
2: from /Users/myusername/.rvm/gems/ruby-2.7.1/bin/bundle:23:in `<main>'
1: from /Users/myusername/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
/Users/myusername/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your /Users/myusername/myrailsapp/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.3`
When I try and update the bundler, I get
$ bundle update --bundler
Fetching https://github.com/mimemagicrb/mimemagic.git
Fetching gem metadata from https://rubygems.org/.......
You have requested:
rails ~> 6.0.0
The bundle currently has rails locked at 4.2.10.
Try running `bundle update rails`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
正如您所料,运行“捆绑更新”也会导致错误……</p>
$ bundle update
Traceback (most recent call last):
4: from /Users/myusername/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:22:in `<main>'
3: from /Users/myusername/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:22:in `eval'
2: from /Users/myusername/.rvm/gems/ruby-2.7.1/bin/bundle:23:in `<main>'
1: from /Users/myusername/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
/Users/myusername/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your /Users/myusername/myrailsapp/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.3`
不知道从这里可以去哪里。
解决方案
推荐阅读
- kubernetes - 如果我删除 etcd 中的 pod 数据,kubelet 会发生什么?
- pandas - Pandas sort_values 给出了意想不到的结果
- vue.js - 如何为带参数的链接设置 nuxt-link 的活动类?
- javascript - 将 SweetAlert2 与 TypeScript 一起使用,找不到模块“sweetalert2/dist/sweetalert2.js”的声明文件
- javascript - 在 SwitchMap 运算符中使用 Promise
- android - 如何执行向上滚动操作,直到找出需要使用 espresso 的元素
- python-3.x - 如何使用 Pandas 按降序排序日期和按升序排序时间
- python - 使用 heredocs 或更好的方法编写 Bash 脚本
- javascript - 收到欢迎信息后触发函数
- android - 如何在 Android 中使用我自己的本机代码使用第三方本机代码?