![](/img/trans.png)
[英]Could not able to deploy my rails project after Heroku-18 stack upgrade
[英]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 gist和Gemfile.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.