ruby-on-rails - Heroku 应用程序的 Bundler 运行的 Ruby 版本错误
问题描述
我有一个使用 Ruby 2.6.5 和 Rails 6.0.2.2 的 Rails Heroku 应用程序。这是Heroku支持的 Ruby 版本,我在 .ruby-version、我的 Gemfile 和 Gemfile.lock 中指定了它:
~ $ cat .ruby-version
2.6.5
~ $ cat Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.5'
[...]
~ $ cat Gemfile.lock
[...]
RUBY VERSION
ruby 2.6.5p114
但是,当我bundler env
在远程应用程序上运行时,这是输出的第一部分:
~ $ bundle env
## Environment
Bundler 2.0.2
Platforms ruby, x86_64-linux
Ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
Full Path /usr/bin/ruby2.5
Config Dir /etc
RubyGems 2.7.6
Gem Home /var/lib/gems/2.5.0
Gem Path /app/vendor/bundle/ruby/2.6.0:
User Path /app/.gem/ruby/2.5.0
Bin Dir /usr/local/bin
Tools
Git 2.17.1
RVM not installed
rbenv not installed
chruby not installed
请注意,它使用的是 Ruby 2.5.1。这阻止了我运行 Rails 迁移,因为我总是得到错误Your Ruby version is 2.5.1, but your Gemfile specified 2.6.5
。我错过了什么吗?
我尝试过的事情并没有导致行为发生任何变化:
- 使用该应用程序启动一个全新的 Heroku 应用程序,并进行全新部署
- 在 Heroku 应用程序上运行
/bin/bash
并手动更新 Bundler
有什么方法可以让 Bundler 使用正确版本的 Ruby?
解决方案
推荐阅读
- keras - Keras Loss:允许多个 y_true 值正确
- c# - C# 从串口读取数据 - 如何只获取新的/当前数据?
- sql - 命名动态列 plsql plsql (pivot)
- java - 不显示按钮上的 Java 文本
- ionic-framework - 重新打开浏览器后,ionic 3 storage clear
- android - 如何通过 adb wifi 连接安装应用程序?
- python - 如何调用套接字在函数内部进行连接?
- ios - 如何将选定的问卷选择/答案快速保存为字符串?
- html - 如何使用href方法连接html页面
- postgresql - Prevent out of order inserts into a Postgres database