I'm trying to follow the Railscasts episode on jQuery-FileUpload. I've added
gem 'jquery-fileupload-rails'
to the assets group of the Gemfile
, and also added the
//= require jquery-fileupload/basic
line to the application.js
file in the asset directory. When I try to bring up the website, however, the following error is shown:
couldn't find file 'jquery-fileupload'
(in root/app/assets/javascripts/application.js:15)
Any help would be greatly appreciated.
I found a "solution" - restarting rails server did the trick.
Remove it from assets group, and it'll work fine.
I have fix this by :
add
gem 'therubyracer'
gem 'execjs'
to your Gemfile.
and run bundle install
and
rake assets:precompile --trace RAILS_ENV=production
That's really weird, I just tried with a Gemfile
:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "jquery-fileupload-rails"
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
and on application.js
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require jquery-fileupload/basic
and worked great, did you run bundle ? I know its a stupid question but it may be
I think you wanna add the following line to application.js
//= require jquery-fileupload
I ran into something similar lately. What worked for me was to load the gem directly from git
gem 'jquery-fileupload-rails', git: 'git://github.com/ollnixon/jquery-fileupload-rails.git'
And then to load the the needed ui styles
*= require jquery.fileupload-ui
Works flawlessly now
来源:https://stackoverflow.com/questions/15168943/rails-jquery-fileupload-gem-couldnt-find-file-error