繁体   English   中英

此版本的Ruby在Heroku-18上不可用

[英]This version of Ruby is not available on Heroku-18

当我尝试在Heroku上构建我的应用程序时,它失败了,因为Heroku不支持我据称正在使用的Ruby版本。 我的应用程序在本地构建/部署没有问题。 这是完整的消息日志:



-----> Ruby app detected

-----> Compiling Ruby/Rails

       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.3.8.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.

       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.3.8.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.

 !

 !     An error occurred while installing ruby-2.3.8

 !     

 !     This version of Ruby is not available on Heroku-18. The minimum supported version

 !     of Ruby on the Heroku-18 stack can found at:

 !     

 !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes

 !

 !     Push rejected, failed to compile Ruby app.

 !     Push failed

但是,在我的Gemfile和Gemfile.lock中,我没有使用ruby-2.3.8。 这就是为什么我很困惑。 我有指向我的Gemfile gistGemfile.lock gist的链接。

我在Heroku上尝试过的事情:

运行bundle install

这个 无法解决问题,我的Gemfile,Gemfile.lock和本地Ruby是ALL 2.6.3。

确保Gemfile和Gemfile.lock是我的Github中最新的。

运行gem install bundler -v 1.17.3但它给我ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.5.0 directory

编辑:

在运行heroku run ruby -v之后,我的Ruby版本实际上是ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

捆绑程序的“受祝福”版本可能尚未更新为2.0.2 ,而官方的ruby buildpack仅支持2.0.1

要进行测试,可以手动编辑Gemfile.lock并更改:

BUNDLED WITH
  2.0.2

2.0.1

但是,每次bundle时,它将被覆盖,因此,如果是这样,您可能需要暂时降级捆绑器。

在Heroku上,您无法直接配置捆绑软件的版本-> https://devcenter.heroku.com/articles/bundler-version#app-not-using-the-currently-supported-bundler-version

我猜您正在使用heroku buildpack,否则,您将需要进行设置。

您可以使用以下命令切换到受支持的buildpack:

heroku buildpacks:set heroku/ruby

我相信我在heroku无法更新的地方遇到了问题,请在此处尝试前2个答案: Heroku是否未更新我的代码?

heroku的陷阱之一是您将需要使用它们的构造。 我将确保您在部署之前和部署之后使用本地想要的任何版本的捆绑程序和红宝石,然后通过在heroku框上确认是否为相同版本来进行确认。

旁注,使用ruby关键字仅适用于某些版本的捆绑器https://devcenter.heroku.com/articles/ruby-versions#selecting-a-version-of-ruby

我通常将红宝石版本设置在项目根目录的.ruby-version文件中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM