【问题标题】:Rails precompilation error in production生产中的Rails预编译错误
【发布时间】:2012-06-10 17:32:13
【问题描述】:

我收到此错误:

Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Main#index

Showing /etc/apache2/CrawlFish/app/views/layouts/application.html.erb where line #15 raised:

jquery-ui-1.8.20.custom.min isn't precompiled

在 config/environements/production.rb 中,我添加了这一行:

config.assets.precompile += %w( jquery-ui-1.8.20.custom.min.js )

即使在这样做之后,我仍然收到上述预编译错误。在 public/assets/manifest.yml 中,没有 jquery-ui-1.8.20.custom.min.js 文件的条目。但是在 public/assets 中,会生成这些文件:

jquery-ui-1.8.20.custom.min-3ef66af7d5b20341b5fceb4ad1b2755f.js
jquery-ui-1.8.20.custom.min-3ef66af7d5b20341b5fceb4ad1b2755f.js.gz
jquery-ui-1.8.20.custom.min.js
jquery-ui-1.8.20.custom.min.js.gz

如何解决这个问题?

【问题讨论】:

  • application.html.erb 第 15 行说什么?
  • @AnatortoiseHouse:第 15 行:

标签: ruby-on-rails ruby production-environment


【解决方案1】:

你有没有像 jquery-ui 一样添加你的 jquery-ui

//= require jquery
//= require jquery-ui
//= require jquery_ujs

你为什么这样称呼它?

config.assets.precompile += %w( jquery-ui-1.8.20.custom.min.js )

如果它在资产文件夹中,你应该没有任何问题。

你的application.rb上有下面的代码吗

config.assets.initialize_on_precompile = false

我可能错了,但我会尝试的

【讨论】:

  • 我尝试在 application.rb 中添加 //=require jquery-ui。仍然遇到同样的错误
  • 也许你应该删除这一行 config.assets.precompile += %w( jquery-ui-1.8.20.custom.min.js )
猜你喜欢
  • 2016-10-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多