ruby-on-rails - Heroku 在运行 `bundle install` 时使用较旧的 Ruby 版本
问题描述
我正在尝试在 Heroku 上的 Ruby 2.7.1 上运行 Rails 应用程序。一切正常,然后我在 Gemfile 中更改了一些内容以使用Ruby 2.7 的编号参数,现在部署失败并显示以下错误消息:
remote: -----> Build succeeded!
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.0.2
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote:
remote: !
remote: ! There was an error parsing your Gemfile, we cannot continue
remote: !
remote: ! [!] There was an error parsing `Gemfile`: Undefined local variable or method `_1' for Gemfile. Bundler cannot continue.
remote: !
remote: ! # from /tmp/build_6681cf5c/Gemfile:22
remote: ! # -------------------------------------------
remote: ! # dependencies.any? { _1.name == gem_name }
remote: ! # -------------------------------------------
remote: ! . Bundler cannot continue.
它在本地运行良好,我一直在其他几个 Rails 应用程序中使用相同的代码,部署从来都不是问题。
由于该错误Undefined local variable or method '_1' for Gemfile.
,我假设运行时使用了 < 2.7 的 Ruby 版本bundle install
。该应用程序本身在 Ruby 2.7.1 上运行良好:
$ heroku run "ruby -v"
Running ruby -v on ⬢ myapp... up, run.7979 (Free)
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
这里还有一些其他类似的问题,但它们都处理 Heroku 不尊重 Gemfile 或 .ruby-version 中设置的 Ruby 版本,这对我来说不是问题,只是在bundle install
它似乎使用不同的 Ruby 版本一些原因...
有没有办法进一步调试,或者即使在bundle install
部署期间也强制使用 Ruby 2.7?
解决方案
推荐阅读
- firebase - Flutter Firebase Analytics: Track page changes with onGenerateRoute
- php - 链接到 Mysql 和搜索功能的下拉框
- r - R中接受和返回向量的函数
- python - 有时为什么我们必须在 python 中将参数作为元组传递?
- reactjs - 使用值从 React 调用 .NET Core 控制器方法
- java - @DataJpaTest 使用存储库保存实体,无法使用 JdbcTemplate 检索数据
- javascript - 如何正确设置元素的高度属性?
- python - 将数据集拆分为训练和测试以在 python 中进行时间序列分析
- javascript - 为什么我的 useEffect 中仍然有陈旧的数据?
- javascript - Angular - 惊人的时间选择器(ATP)TimePicker在选择小时后不会切换到分钟