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.
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:
Add
'therubyracer', :platforms => :rubyto thegroup :assetsand upgrade your ruby version. Then remove your Gemfile.lock and runbundle install.Run
assets:precompilein your local machine and push them to heroku (don't forget to remove therubyracer gems from production);- Rails asset pipeline supports the Sass language by default. Instead of
rails-bootstrapgem (LESS) you can usebootstrap-sass-rails
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
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
来源:https://stackoverflow.com/questions/6259130/therubyracer-fails-to-build-on-heroku