简体   繁体   English

当我运行rake资产时:precompile得不到app.js中的文件'jquery'// = require jquery

[英]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.

相关问题 找不到文件“ jquery-ui”,即使我的application.js中有此文件,我也收到此错误 - couldn't find file 'jquery-ui' i get this error even after having this file in my application.js 捆绑exec rake资产:生成的application.js文件的预编译问题 - bundle exec rake assets:precompile issue with the generated application.js file rake预编译资产在rake资产时失败:预编译 - 基本上是空的application.js - RoR Precompiling Assets fail while rake assets:precompile - on basically empty application.js Rails 3.1资产管道预编译错误 - 找不到文件'jquery' - Rails 3.1 Assets Pipeline Precompile Error - couldn't find file 'jquery' Webpacker 在 /app/public/packs/manifest.json 中找不到 application.js,删除 node_modules 文件夹后我无法预编译资产 - Webpacker can't find application.js in /app/public/packs/manifest.json and I can't precompile assets after deleting node_modules folder Rails 4:application.js中的“ // = require_tree”在/ app / assets / javascripts中不包含我的js文件 - Rails 4: “//= require_tree .” in application.js doesn't include my js file in /app/assets/javascripts rails - 如何升级我的jquery,我没有在app / assets中看到它,但它在application.js中被引用? - rails - how can I upgrade my jquery, I don't see it in app/assets but it's referenced in application.js? application.js找不到我要包含的文件 - application.js can't find the file I'm including 在我的application.js文件中出现错误“无法找到文件'ckeditor / override'” - Trouble on error “couldn't find file 'ckeditor/override'” in my application.js file rake assets:特定JS文件的预编译 - rake assets:precompile for specific JS file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM