Rails Error In Production, may due to link_tag and precompilation

前端 未结 1 1252
长发绾君心
长发绾君心 2020-12-18 08:57

I have installed rails 3.1 with apache2 and passenger on ubuntu 10.04. using ruby 1.9.2 with RVM

相关标签:
1条回答
  • 2020-12-18 09:55

    I've found the answer myself, The reason for the error is rails app needs javascript runtime for certain features of sass, coffeescript and uglifier to work.

    There are many ways to solve this, by installing javascript runtimes like nodejs

    But, the solution I went with, and perhaps the easiest one is, adding gem 'therubyracer' to my Gemfile and then running bundle install

    Excerpt from my Gemfile is below

    # Gems used only for assets and not required
    # in production environments by default.
    group :assets do
      gem 'therubyracer'
      gem 'sass-rails', "  ~> 3.1.0"
      gem 'coffee-rails', "~> 3.1.0"
      gem 'uglifier'
    end
    

    adding therubyracer also fixes rake assets:precompile

    Hope this helps. I've spent days searching for this solution.

    0 讨论(0)
提交回复
热议问题