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'
我不知道如何告诉捆绑商我还在使用ruby 2.2.0。我的捆绑包在底部有这个:
RUBY VERSION
ruby 2.3.0p0
BUNDLED WITH
1.12.1
为什么bundler没有使用ruby 2.2.0版本?它使用的是2.3.0而不是......
答案 0 :(得分:3)
检查Gemfile.lock
。最新版本的bundler添加了用于安装gem的ruby版本和bundler版本(并生成Gemfile.lock)。
在底部你会发现:
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文件。
答案 1 :(得分:1)
最后,我添加删除bundler并安装与Heroku相同的版本。
答案 2 :(得分:0)
有时捆绑包不会在Gemfile.lock中生成
RUBY VERSION
ruby 2.x.x
在这种情况下,只需在Gemfile.lock文件提交中手动添加该条目并将其推入master。 Heroku将采用该版本并进行构建。