i’m testing the deployment af RoR 4.2.x app…
when i execute it in development all runs fine,
if i simulate deployment on a vm to prepare final deployment phase,
i receive an error during asset precompilation….
the deployment env is ubuntu 14.04 lts server using rvm, passenger and Apache as web server..
after all needed library updates (as prerequisites) i’ve done a checkout of the repo to the working dir onto web server,
then correctly executed ‘bundle update’ inside the working dir to correctly populate the gemset…
during this phase no errors are returned from the server console, all seems to run fine…
if i run ‘gem list’ all needed gems results present
now, precompiling assets using the command:
RAILS_ENV=production bundle exec rake assets:precompile
the operation aborts after few seconds with this error:
rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery-ui' with type 'application/javascript'
/home/rails-usr/www_v2/app/assets/javascripts/application.js:10
/home/rails-usr/.rvm/gems/ruby-2.2.2@Best-i-gest_v2/gems/sprockets-3.6.2/lib/sprockets/resolve.rb:64:in `resolve!'
/home/rails-usr/.rvm/gems/ruby-2.2.2@Best-i-gest_v2/gems/sprockets-3.6.2/lib/sprockets/directive_processor.rb:399:in `resolve'
/home/rails-usr/.rvm/gems/ruby-2.2.2@Best-i-gest_v2/gems/sprockets-3.6.2/lib/sprockets/directive_processor.rb:207:in `process_require_directive'
.....
going to add some more info to my question…
here is my app ‘Gemfile’
source 'http://rubygems.org'
gem 'rails', '4.2.5'
gem 'mysql2', '0.3.17'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'declarative_authorization', :git => 'git://github.com/stffn/declarative_authorization'
gem 'ruby_parser'
gem 'jQuery-Validation-Engine-rails'
gem 'prawn', '1.3.0'
gem 'prawn-table', '0.2.1'
# gem 'bootstrap-sass', '~> 3.1.1'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem "therubyracer"
gem "less-rails", :git => 'git://github.com/metaskills/less-rails', :ref => '539f28d'
gem 'jquery-datatables-rails' , :git => 'git://github.com/rweng/jquery-datatables-rails'
gem 'jquery-ui-rails'
end
gem 'twitter-bootstrap-rails', :git => 'git://github.com/coppolaf/tb3-rails4.git'
gem 'jquery-rails'
gem 'will_paginate'
gem 'nokogiri'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', '~> 0.8.3', :require => false
end
this is ‘application.js’ file:
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require twitter/bootstrap
//= require jquery.validationEngine
//= require_tree .
....
this is ‘application.css’ file:
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require jquery-ui
*= require dataTables/src/demo_table_jui
*= bootstrap_and_overrides.css.less
*= require validationEngine.jquery
*= require_tree .
*/
....
pls note all jquery modules runs fine in development, the requested module seems to be present inside gemset….
waiting your suggestions,
regards,
francesco
2
Answers
Thanks to Wishalizer suggestions, i've finally solved this issue...
the error is related to the Gemfile structure.... i've modified it as follows......
file: 'Gemfile'
moving the references to jquery-ui-rails and jquery-datatables-rails outside the assets section... enables the assets precompilation task to complete without errors!!
hoping this to be helpful....
bye francesco
From the sprockets error you posted, I expect this line is missing from your
application.js
Documentation
Added
Your additional information is helpful. Your application.css should not include jquery-ui, which is not css and will throw a sprockets error consistent with what you’re seeing. I would reduce your application.css to include to only css type assets.
Let me know how this goes.
Suggested test
I just noticed that there is a diff between dev and prod. in your jquery-ui setup. This is an important test, since it is an asset load problem you’re seeing. This what you have:
Try moving the gem outside the assets group in the Gemfile, like below and
$bundle install
and test:Let me know what happens