我正在测试RoR 4.2.x应用的部署...
当我在开发中执行它时,一切运行良好,如果我在vm上模拟部署以准备最终部署阶段,则在资产预编译过程中会收到错误消息。
部署环境是使用rvm,passenger和Apache作为Web服务器的ubuntu 14.04 lts服务器。
在完成所有需要的库更新(作为前提条件)之后,我已经将工作目录的存储库签出到Web服务器上,然后在工作目录中正确执行了“捆绑更新”以正确填充gemset ...
在此阶段,服务器控制台未返回任何错误,一切似乎都正常运行...
如果我运行“宝石列表”,则显示所有需要的宝石结果
现在,使用以下命令预编译资产:
RAILS_ENV=production bundle exec rake assets:precompile
几秒钟后,该操作将中止,并显示以下错误:
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'
.....
要为我的问题添加更多信息...
这是我的应用程序“ 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
这是“ application.js”文件:
// 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 .
....
这是“ application.css”文件:
/*
* 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 .
*/
....
请注意,所有jquery模块在开发中都运行良好,所请求的模块似乎存在于gemset中。
等待您的建议,
问候,法国
感谢Wishalizer的建议,我终于解决了这个问题...
该错误与Gemfile结构有关。...我对其进行了如下修改...
文件:“ 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'
end
gem 'twitter-bootstrap-rails', :git => 'git://github.com/coppolaf/tb3-rails4.git'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery-datatables-rails' , :git => 'git://github.com/rweng/jquery-datatables-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
将对jquery-ui-rails和jquery-datatables-rails的引用移到资产部分之外...可以使资产预编译任务顺利完成!!
希望对您有所帮助。
再见法国
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句