9

私は少し絶望的です。何日もこの問題をデバッグしようとしてきました。誰でもトラブルシューティング方法を知っていますか? おそらく、エンコーディングの問題を引き起こしているファイルを特定できますか?

FWIW: これは開発環境で動作します:RAILS_ENV=production bundle exec rake assets:precompile --trace

しかし、これは「本番」サーバーでは失敗します...トラブルシューティングを開始する方法がわかりません:

$ RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
I, [2013-09-26T10:54:13.904512 #8431]  INFO -- : Writing /rails/myapp/releases/20130926175008/public/assets/sort_asc-9348a2efdfbcfa28135e10d4f7b42d0d.png
I, [2013-09-26T10:54:13.945109 #8431]  INFO -- : Writing /rails/myapp/releases/20130926175008/public/assets/sort_asc_disabled-30ae6b96c67982047ca4cfa0b8ce81b2.png
I, [2013-09-26T10:54:14.007435 #8431]  INFO -- : Writing /rails/myapp/releases/20130926175008/public/assets/sort_both-8018c940cc83bb4cf2bf0e68e41fdcc0.png
I, [2013-09-26T10:54:14.011733 #8431]  INFO -- : Writing /rails/myapp/releases/20130926175008/public/assets/sort_desc-05521e27371d9dd4e6febce9314bc7ed.png
I, [2013-09-26T10:54:14.017370 #8431]  INFO -- : Writing /rails/myapp/releases/20130926175008/public/assets/sort_desc_disabled-a3215e17d6bf077db02468b895fee228.png
rake aborted!
Caught Encoding::CompatibilityError at '["ok","!function(e,t': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
  (in /rails/myapp/releases/20130926175008/app/assets/javascripts/application.js)
/rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:242:in `rescue in parse_string'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:213:in `parse_string'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:257:in `parse_value'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:121:in `parse'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:334:in `load'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:62:in `extract_result'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:28:in `block in exec'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/execjs-2.0.1/lib/execjs/external_runtime.rb:27:in `exec'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/uglifier-2.2.1/lib/uglifier.rb:176:in `really_compile'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/uglifier-2.2.1/lib/uglifier.rb:100:in `compile'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/uglifier_compressor.rb:25:in `evaluate'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:197:in `block in evaluate'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `each'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `evaluate'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:25:in `initialize'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `new'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `build_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/rails/myapp/shared/bundle/ruby/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/rails/myapp/shared/bundle/ruby/2.0.0/bin/rake:23:in `load'
/rails/myapp/shared/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile

Gemfile (要求に応じて):

source 'https://rubygems.org'
ruby '2.0.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
gem 'pg'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :development, :test do
  gem 'rspec-rails'
  gem 'factory_girl_rails'
  gem 'guard-rspec'
  # gem 'debugger'
end

group :development do
  gem 'annotate'
  gem 'spork-rails', github: 'sporkrb/spork-rails'
  gem 'guard-spork'
  gem 'awesome_print'
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'pry-rails' #substitute pry for irb
end

group :test do
  gem 'selenium-webdriver'
  gem 'capybara'
  gem 'faker'
  gem 'database_cleaner'
  gem 'poltergeist'
  gem 'launchy'
end

gem 'rvm-capistrano' #, group: :development
gem 'haml-rails'
# gem 'zurb-foundation'
# gem 'foundicons-rails'
gem 'bootstrap-sass', :git => 'git://github.com/thomas-mcdonald/bootstrap-sass.git' #, :branch => '3'
gem 'kaminari'
gem 'ancestry'
gem 'twitter-typeahead-rails'
# gem 'bootstrap-typeahead-rails' #TODO
gem 'hogan_assets'
gem 'awesome_print'
gem 'multi_json', '1.7.8' # error in cap deploy with version 1.7.9
# gem 'json' # not necessary before multi_json deploy failure

gem 'textacular'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
4

2 に答える 2

2

マニフェストからファイルを削除してからデプロイを試みるサイクルを開始するだけです。それでも問題が解決しない場合は、マニフェストから次のファイルを削除し、問題の原因となっているファイルが見つかるまで繰り返します。

于 2013-09-27T03:20:31.973 に答える
1

同様の問題に直面しました - assets:precompile 中に InvalidByteSequenceError が発生しました。私がしたことは、スプロケットの宝石コードを少し編集して、デバッグ情報、特に現在処理されているファイル名を「配置」することでした。次に、プリコンパイルを再度実行し、デバッグ出力に基づいてファイルを見つけて修正しました。それからもちろん、宝石の変更を元に戻しました。バックトレースがあるため、同じアプローチを使用できます。さらに、 asstes:precompile タスクをデバッグすることもできます (インライン デバッガーまたはお気に入りの IDE を使用)。

于 2016-06-29T12:41:05.467 に答える