无法推送到Heroku:在Ruby版本上失败

时间:2016-12-18 15:57:06

标签: ruby-on-rails ruby heroku

当我推送到Heroku时,我收到以下错误:

remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote:        Your app was upgraded to bundler 1.13.6.
remote:        Previously you had a successful deploy with bundler 1.11.2.
remote:        
remote:        If you see problems related to the bundler version please refer to:
remote:        https://devcenter.heroku.com/articles/bundler-version
remote: -----> Using Ruby version: ruby-2.3.0
remote: -----> Installing dependencies using bundler 1.13.6
remote:        Ruby version change detected. Clearing bundler cache.
remote:        Old: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
remote:        New: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Your Ruby version is 2.3.0, but your Gemfile specified 2.3.1
remote:        Bundler Output: Your Ruby version is 2.3.0, but your Gemfile specified 2.3.1
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed

它在本地工作。在本地,ruby -v会返回ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]rvm list rubies给出以下内容:

   ruby-1.9.3-p551 [ x86_64 ]
   ruby-2.1.5 [ x86_64 ]
   ruby-2.2.1 [ x86_64 ]
=* ruby-2.3.1 [ x86_64 ]

如何解决这个问题? Heroku还没有接受Ruby 2.3.1吗?我当然可以在本地切换回版本2.3.0但我希望这不是必要的吗?

1 个答案:

答案 0 :(得分:1)

您可以运行gem install bundler,然后bundle install更新Gemfile.lock中的Ruby版本,以便应用可以使用Gemfile中指定的正确Ruby版本。