简体   繁体   English

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

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

When I try to build my app on Heroku, it fails because the Ruby version I purportedly am using is not supported by Heroku. 当我尝试在Heroku上构建我的应用程序时,它失败了,因为Heroku不支持我据称正在使用的Ruby版本。 My app has no problem building/deploying locally. 我的应用程序在本地构建/部署没有问题。 Here is full message log: 这是完整的消息日志:



-----> 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

However, in my Gemfile and Gemfile.lock, I am NOT using ruby-2.3.8. 但是,在我的Gemfile和Gemfile.lock中,我没有使用ruby-2.3.8。 That is why I am very confused. 这就是为什么我很困惑。 I have links to my Gemfile gist and Gemfile.lock gist . 我有指向我的Gemfile gistGemfile.lock gist的链接。

Things I have tried on Heroku: 我在Heroku上尝试过的事情:

Running bundle install . 运行bundle install

This . 这个 Did not resolve issue, my Gemfile, Gemfile.lock, and local Ruby is ALL 2.6.3. 无法解决问题,我的Gemfile,Gemfile.lock和本地Ruby是ALL 2.6.3。

Making sure Gemfile and Gemfile.lock are the most recent ones in my Github. 确保Gemfile和Gemfile.lock是我的Github中最新的。

Running gem install bundler -v 1.17.3 but it gives me ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.5.0 directory 运行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

EDIT: 编辑:

It appears after running heroku run ruby -v , that my Ruby version is actually ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu] 在运行heroku run ruby -v之后,我的Ruby版本实际上是ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

It's possible that the "blessed" version of bundler hasn't been updated yet to 2.0.2 , and only 2.0.1 is supported on the official ruby buildpack. 捆绑程序的“受祝福”版本可能尚未更新为2.0.2 ,而官方的ruby buildpack仅支持2.0.1

To test this out, you can edit your Gemfile.lock manually and change: 要进行测试,可以手动编辑Gemfile.lock并更改:

BUNDLED WITH
  2.0.2

to 2.0.1 2.0.1

It will be overridden every time you bundle though, so if that is the fix, you might want to downgrade bundler for the time being. 但是,每次bundle时,它将被覆盖,因此,如果是这样,您可能需要暂时降级捆绑器。

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

I am guessing you are using the heroku buildpack, if not you will want to set that up. 我猜您正在使用heroku buildpack,否则,您将需要进行设置。

You can switch to a supported buildpack with: 您可以使用以下命令切换到受支持的buildpack:

heroku buildpacks:set heroku/ruby

I believe I have had issues where heroku wasn't updating, try the top 2 answers here: Heroku is not updating my code? 我相信我在heroku无法更新的地方遇到了问题,请在此处尝试前2个答案: Heroku是否未更新我的代码?

One of the pitfalls of heroku is you will need to work with in their construct. heroku的陷阱之一是您将需要使用它们的构造。 I would make sure you are using whatever version of bundler and ruby they want locally prior to deployment and after deployment confirm by sshing on to the heroku box to confirm it is the same version. 我将确保您在部署之前和部署之后使用本地想要的任何版本的捆绑程序和红宝石,然后通过在heroku框上确认是否为相同版本来进行确认。

Sidenote, using the ruby keyword will only work for certain versions of bundler https://devcenter.heroku.com/articles/ruby-versions#selecting-a-version-of-ruby 旁注,使用ruby关键字仅适用于某些版本的捆绑器https://devcenter.heroku.com/articles/ruby-versions#selecting-a-version-of-ruby

I usually set my ruby version in a .ruby-version file in the root of the project. 我通常将红宝石版本设置在项目根目录的.ruby-version文件中。

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

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