Heroku 最近发生了一些变化。我无法像以前那样部署我的应用程序:
me@host my-project (master) $ git push staging master
Counting objects: 52, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (52/52), 159.47 KiB | 0 bytes/s, done.
Total 52 (delta 42), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Deleting 4 files matching .slugignore patterns.
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.0
remote: -----> Installing dependencies using bundler 1.13.6
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: Ruby version change detected. Clearing bundler cache.
remote: Old: ruby 2.2.0p0 (2014-12-25 revision 49005) [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.2.0
remote: Bundler Output: Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-project-staging.
remote:
To https://git.heroku.com/my-project-staging.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-project-staging.git'
我不明白,我从一开始就使用ruby 2.2.0
:
me@host my-project (master) $ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
me@host my-project (master) $ cat .ruby-version
2.2.0
me@host my-project (master) $ cat Gemfile | grep 'ruby'
ruby '2.2.0'
我不知道如何告诉 bundle 程序我仍在使用 ruby 2.2.0。我的 bundler 底部有这个:
RUBY VERSION
ruby 2.3.0p0
BUNDLED WITH
1.12.1
为什么bundler不使用ruby 2.2.0版本?它使用 2.3.0 代替...
最佳答案
检查您的Gemfile.lock
。最新版本的 bundler 添加了用于安装 gem(并生成 Gemfile.lock)的 ruby 版本和 bundler 版本。
在底部您会发现:
RUBY VERSION
ruby 2.3.0
BUNDLED WITH
1.13.1 # or whatever version of bundler you're using
删除它,然后使用正确版本的 ruby 重新运行 bundle install
- 您可能需要删除并重新添加 gem 来触发 Gemfile.lock 文件的重新构建。
关于ruby - 在 Heroku 上部署,如何指定用于 bundler 的 ruby 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40672837/