2012-06-10 115 views
0

我收到此錯誤:Rails的預編譯錯誤

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 
在配置/ 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文件的條目。但在公共/資產中,有這些文件生成:

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 

如何解決此問題?

+0

是什麼application.html.erb線15說呢? –

+0

@AnatortoiseHouse:第15行:<%= javascript_include_tag「jquery-ui-1.8.20.custom.min」%> – Carsen

回答

1

您已將jQuery的用戶界面,像這樣的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 

我可能是錯的方式,但我會嘗試

+0

我試着添加// = require jquery-ui,並且還在application.rb中。仍然得到相同的錯誤 – Carsen

+0

也許你應該刪除這行config.assets.precompile + =%w(jquery-ui-1.8.20.custom.min.js) – Benjamin