开发者

therubyracer fails to build on heroku

开发者 https://www.devze.com 2023-03-11 01:48 出处:网络
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.

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开发者_Python百科: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.


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


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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号