在rails 4上使用Sprockets的application.js中找不到文件错误

时间:2014-09-11 05:43:39

标签: jquery ruby-on-rails ruby-on-rails-4 asset-pipeline sprockets

您好我在Rails 4.1.5

上收到了错误Sprockets::FileNotFound: couldn't find file 'jquery-fileupload/basic.js'

我搜索了一些相关的问题,但找不到解决方案。

的application.js

//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require twitter/bootstrap
//= require jquery-fileupload/basic
//= require jquery-fileupload/vendor/tmpl

我使用rbenv并且gem /jquery-fileupload-rails-0.4.1结构是

〜/ .rbenv /版本/ 2.1.2 / LIB /红宝石/宝石/ 2.1.0 /宝石/ jQuery的文件上传-导轨-0.4.1 /供应商/资产/ Javascript角

.
└── jquery-fileupload
    ├── basic.js
    ├── cors
    │   ├── jquery.postmessage-transport.js
    │   └── jquery.xdr-transport.js
    ├── index.js
    ├── jquery.fileupload-fp.js
    ├── jquery.fileupload-ui.js
    ├── jquery.fileupload.js
    ├── jquery.iframe-transport.js
    ├── locale.js
    └── vendor
        ├── canvas-to-blob.js
        ├── jquery.ui.widget.js
        ├── load-image.js
        └── tmpl.js

当我跑rake assets:precompile --trace

我收到以下错误消息

/Users/hsu-wei-cheng/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant Mime::PDF
/Users/hsu-wei-cheng/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/http/mime_type.rb:163: warning: previous definition of PDF was here
** Execute assets:precompile
rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery-fileupload/basic.js'
  (in /Users/hsu-wei-cheng/workspace/Rails/dqa_dev_server/app/assets/javascripts/application.js:18)
/Users/hsu-wei-cheng/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:106:in `resolve'
/Users/hsu-wei-cheng/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:146:in `require_asset'
/Users/hsu-wei-cheng/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/spro

的Gemfile

gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery.fileupload-rails', "~> 1.10.0"
gem 'twitter-bootstrap-rails'


gem "bootstrap-sass", "~> 3.1.1"
gem "compass-rails"
gem "therubyracer"
gem "execjs"

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

0 个答案:

没有答案