生产中的Rails预编译错误

问题描述 投票:0回答:1

我收到此错误:

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文件的条目。 但是在公共/资产中,会生成以下文件:

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

如何解决这个问题?

ruby-on-rails ruby production-environment
1个回答
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

我可能错了,但我会尝试

© www.soinside.com 2019 - 2024. All rights reserved.