therubyracer fails to build on heroku

旧街凉风 提交于 2019-12-08 03:31:12

问题


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.


回答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



回答2:


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




回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!