rails 4.2资产预编译问题

coppola_f

我正在测试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中。

等待您的建议,

问候,法国

coppola_f

感谢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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Rails 4 Heroku资产:预编译失败

来自分类Dev

Rails 4:在资产预编译产生未发现资产问题后,以生产模式运行应用程序

来自分类Dev

如何使用Capistrano 2部署Rails 4并在本地预编译资产

来自分类Dev

关于CI的Rails资产预编译问题

来自分类Dev

Rails 4-Heroku,预编译资产失败

来自分类Dev

预编译资产出现Rails 4 / Capistrano错误

来自分类Dev

Heroku不会为Rails4预编译资产

来自分类Dev

在Rails 4 App生产中预编译资产

来自分类Dev

Heroku不会为Rails4预编译资产

来自分类Dev

Rails 4-Heroku,无法推送,预编译资产失败

来自分类Dev

Rails 4-Heroku,预编译资产失败

来自分类Dev

Rails 4,资产编译

来自分类Dev

预编译Rails AngularJS资产

来自分类Dev

预编译资产失败的Rails

来自分类Dev

预编译Rails AngularJS资产

来自分类Dev

Rails 4-预编译资产破坏了我的Bootstrap下拉菜单

来自分类Dev

Rails 4 Heroku部署错误:预编译资产失败-无法导入/查找boostrap文件

来自分类Dev

Rails 是部署后的预编译资产 - Amazon EC2

来自分类Dev

Rails资产:预编译不编译要求

来自分类Dev

预编译coffeescript文件(Rails 4)

来自分类Dev

在不同布局中预编译资产-Rails

来自分类Dev

在Rails中禁用资产预编译功能

来自分类Dev

Rails资产:预编译失败,无效的CSS

来自分类Dev

Rails 6 heroku预编译资产失败

来自分类Dev

Rails 6 Capistrano错误“资产:预编译”

来自分类Dev

在Rails中禁用资产预编译功能

来自分类Dev

rake资产:针对rails的预编译2.3.18

来自分类Dev

Rails-预编译资产上的RoutingError

来自分类Dev

Rails:生产资产:预编译错误