2

I've made a Rails 3.1 PoC application that also uses haml by adapting the examples from the railstutorial.org book and locally everything works fine.
But when I try to push to heroku, therubyracer fails to build on the server (full output):

Installing therubyracer (0.8.2) with native extensions /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

My Gemfile is pretty standard, so I would really appreciate if somebody could help me understand what's going wrong, and maybe give me a hand in finding a solution.

Marius Butuc
  • 17,781
  • 22
  • 77
  • 111

3 Answers3

4

These answers are out of date. You can now just use therubyracer in both environments so long as you have version '>= 0.11.2'

I should note that I am the author of therubyracer and use it in several production heroku apps both during asset compile time and at runtime

Charles Lowell
  • 1,157
  • 8
  • 10
1

Heroku no longer requires, but strongly discourages using therubyracer or therubyracer-heroku, as these gems use a very large amount of memory.

If you are using them your next deploy will fail!

You have 2 choices:

  1. Add 'therubyracer', :platforms => :ruby to the group :assets and upgrade your ruby version. Then remove your Gemfile.lock and run bundle install.

  2. Run assets:precompile in your local machine and push them to heroku (don't forget to remove therubyracer gems from production);

  3. Rails asset pipeline supports the Sass language by default. Instead of rails-bootstrap gem (LESS) you can use bootstrap-sass-rails
Beta
  • 96,650
  • 16
  • 149
  • 150
jbatista
  • 964
  • 2
  • 11
  • 26
1

You need to use therubyracer-heroku.

Just define a pair of groups in your Gemfile to install the correct one where required.

group :development, :test do
  gem 'therubyracer'
end

group :production do
  gem 'therubyracer-heroku'
end
Douglas F Shearer
  • 25,952
  • 2
  • 48
  • 48