In some cases it might be necessary to explicitly name the desired ruby version in your Gemfile.
Especially when new Ruby versions come up, such as the latest Ruby 2.0, this article might apply.
Problem:
Your app, a Ruby on Rails 4 app for example, requires a Ruby version newer than the one picked by your current buildpack.
Workaround:
Specify the version number in your Gemfile.
Example:
source 'https://rubygems.org'
ruby "2.0.0"
gem 'rails', '4.0.0'
...
Exemplary error message given by ~/.cf/crash
Staging error: failed to stage application:
Script exited with status 1
-----> Downloaded app package (4.1M)
Installing ruby.
-----> Using Ruby version: ruby-1.9.2
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Fetching https://github.com/anynines/cfoundry_helper.git
Fetching https://github.com/chrisle/gattica.git
Fetching https://github.com/mongoid/mongoid.git
Installing rake (10.1.0)
Installing i18n (0.6.5)
Installing minitest (4.7.5)
Installing multi_json (1.7.9)
Installing atomic (1.1.13)
Installing thread_safe (0.1.2)
Installing tzinfo (0.3.37)
Installing activesupport (4.0.0)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.0.0), and Bundler cannot
continue.
Make sure that `gem install activesupport -v '4.0.0'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
/var/vcap/packages/dea_next/buildpacks/lib/installer.rb:17:in `compile': Buildpack compilation step failed: (RuntimeError)
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:26:in `block in compile_with_timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:25:in `compile_with_timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:16:in `block in stage_application'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:12:in `chdir'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:12:in `stage_application'
from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'
Comments
0 comments
Please sign in to leave a comment.