【问题标题】:Rails production bootstrap-sass error on precompile预编译时的 Rails 生产 bootstrap-sass 错误
【发布时间】:2015-05-01 20:36:47
【问题描述】:

在开发环境中,我的 rails 应用程序一切正常。但是当我在生产模式下尝试它时,当我进行一些预编译时会出现这个错误:

RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted!
NoMethodError: undefined method `<<' for true:TrueClass
/home/xxxxx/.rvm/gems/ruby-2.1.5/gems/bootstrap-sass-3.3.4.1/lib/bootstrap-sass/engine.rb:8:in `block in <class:Engine>'
/home/xxxxx/.rvm/gems/ruby-2.1.5/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/xxxxx/.rvm/gems/ruby-2.1.5/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
/home/xxxxx/.rvm/gems/ruby-2.1.5/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'

我已经尝试了多种解决方案,但到目前为止都没有。

我尝试将config.assets.initialize_on_precompile = false 添加到config/application.rb 中,但没有成功...

【问题讨论】:

  • 您是否在生产模式下运行了捆绑安装? RAILS_ENV=production bundle install。也许所需的 gem 不在您的生产组中,但在您的开发组中。
  • @Alexander 是的,我刚刚做了,但没有任何改变:/
  • 失败的行尝试添加到config.assets.precompile 数组,但它不是true 的数组。您的应用中是否有可能有 config.assets.precompile = true?
  • 感谢@infused 我在我的代码中有它...

标签: ruby-on-rails twitter-bootstrap assets precompile


【解决方案1】:

正如@infused 所指出的,我的代码中有一个config.assets.precompile = true 导致了这个错误。删除它解决了这个问题!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-30
    • 2016-10-14
    • 2015-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多