[英]Rails javascript asset missing after precompile
the Rails Guides says: Rails指南说:
If there are missing precompiled files in production you will get an Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError exception indicating the name of the missing file(s).
如果生产中缺少预编译文件,您将获得Sprockets :: Helpers :: RailsHelper :: AssetPaths :: AssetNotPrecompiledError异常,指示丢失文件的名称。
I do execute: 我执行:
bundle exec rake assets:precompile
however I don't get any error, and my javascript file is missing in the manifest.yml . 但是我没有收到任何错误,而且我的javascript文件在manifest.yml中丢失了。 Also it's not appearing in public/assets , so the problem is only on production.
它也没有出现在公共/资产中 ,所以问题只出在生产上。
I have in the application.js 我在application.js中
//= require formalize/jquery-formalize
What am I missing? 我错过了什么?
Thanks. 谢谢。
Actually two things needed to do: 实际上需要做两件事:
config.assets.precompile += %w( *.js *.css )
as described here , and 描述在这里 ,和
config.serve_static_assets = true
for local production testing when using 用于本地生产测试
rail s
of course using 当然使用
rake assets:precompile
however in my case - without config.assets.precompile this would have no effect since the manifest didn't contain any reference to my javascript file. 但是在我的情况下 - 如果没有config.assets.precompile,这将没有任何效果,因为清单不包含对我的javascript文件的任何引用。
HTH. HTH。
Try just: 试试吧:
rake assets:precompile
I've had similar issues and that has worked. 我有类似的问题,而且有效。 You can also delete the contents of the
/public/assets
directory and try running it again. 您还可以删除
/public/assets
目录的内容并尝试再次运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.