无法更新 Gemfile

Can't update Gemfile

我正在将我的 Heroku 托管 ROR 应用程序从 Ruby 1.9.3 升级到 2.3.1p112

我在 Heroku 控制台上收到此错误

remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected a mismatch between your Ruby version installed and
remote:  !     Ruby version specified in Gemfile or Gemfile.lock. You can
remote:  !     correct this by running:
remote:  !     
remote:  !     $ bundle update --ruby
remote:  !     $ git add Gemfile.lock
remote:  !     $ git commit -m "update ruby version"
remote:  !     
remote:  !     If this does not solve the issue please see this documentation:
remote:  !     
remote:  !     https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y

所以我这样做了,但我不确定如何解决它? 2.3.1设置在哪里?如果我将我的 Gemfile 设置为 2.3.1 而不是 2.3.1p112 那么推送到 Heroku 会失败并且会出现上述错误?

 MacBook-Pro-2:treesy-api me$ bundle platform --ruby
ruby 2.3.1p112
MacBook-Pro-2:treesy-api me$ bundler -v
Bundler version 1.17.1
MacBook-Pro-2:treesy-api me$ cat Gemfile.lock | grep -A 2 RUBY
RUBY VERSION
   ruby 2.3.1p112

MacBook-Pro-2:treesy-api me$ bundle update --ruby
Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1p112
MacBook-Pro-2:treesy-api me$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]s

只需使用

ruby '~> 2.5.1'

在你的 Gemfile

2.5.1

在你的 .ruby-version