[英]when I run rake assets:precompile got couldn't find file 'jquery' in application.js on //= require jquery
when I run 我跑的时候
bundle exec rake assets:precompile
I got 我有
couldn't find file 'jquery'
in application.js on line: 在application.js上线:
//= require jquery
Rails 3.2.2. Rails 3.2.2。 What is reason?
是什么原因?
I'd venture to say you don't have a jquery.js file anywhere in your app. 我冒昧地说你的应用程序中没有任何jquery.js文件。 If it's not in app/assets or vendor/assets or lib/assets, add it to one of them -- or if you are using the jquery-rails gem, follow the instructions here .
如果它不在app / assets或vendor / assets或lib / assets中,请将其添加到其中一个 - 或者如果您使用的是jquery-rails gem,请按照此处的说明进行操作。
If you're running in production you must comment out the line 如果您正在投入生产,则必须注释掉该行
Bundler.require(*Rails.groups(:assets => %w(development test)))
and uncomment the following 并取消注释以下内容
Bundler.require(:default, :assets, Rails.env)
since by default gems included in the "assets" group specified in the Gemfile won't be added in the production environment. 因为默认情况下,Gemfile中指定的“assets”组中包含的gems不会添加到生产环境中。
This lead me to a similar situation in which I was running a precompile in production but Uglifier kept throwing me a "couldn't find jquery error" but clean compile in development. 这导致我出现类似的情况,我在生产中运行预编译,但Uglifier一直给我一个“找不到jquery错误”,但在开发中清理编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.