1.10.beta4 から Ember.js 1.13.2 にアップグレードした後、本番環境で非推奨の警告がある Handlebars テンプレートをプリコンパイルできなくなりました。以下の rake assets:precompile のエラーとトレースバックをご覧ください。奇妙なことに、本番環境の Mac ではエラーは発生しませんが、Linux ビルド サーバー (Ubuntu) では失敗します。
調査の結果、ember-template-compiler.js はプリコンパイル中に非推奨の警告を生成し、コンパイル済みの出力と混在しているようです。この JS ファイルには、「Ember ビルド ツールはEmber.deprecate()
、プロダクション ビルドを実行するときに呼び出しを削除します」というコメントがあります。しかし、これがスプロケット ツール チェーンでどのように機能するかはわかりません。プリコンパイル中に application.js ファイルが含まれないため、Ember.deprecate をオーバーライドできません。Ember.deprecate への呼び出しが Rails アセットのプリコンパイルでどのように削除されるかを誰かが言うことができれば、これをさらにデバッグするのに役立ちます。
非推奨を取り除く必要がありますが、時間がかかるかもしれません! この問題についてご協力いただきありがとうございます。
バージョン情報 (ember-cli は使用しません):
- レール 4.2.0
- エンバーレール宝石0.16.1
- 理髪師の宝石 0.9.0
- ember-template-compiler.js 1.13.2
エラー メッセージとトレース:
RAILS_ENV=production bundle exec rake assets:precompile
...
rake aborted!
JSON::ParserError: 757: unexpected token at 'DEPRECATION: The `bind-attr` helper (L1:C7) is deprecated in favor of HTMLBars-style bound attributes.
{anonymous}(/tmp/execjs20150630-36511-b2stmyjs:15523:15)
Walker.visit (/tmp/execjs20150630-36511-b2stmyjs:22029:7)
visitors.Program (/tmp/execjs20150630-36511-b2stmyjs:22039:16)
Walker.children (/tmp/execjs20150630-36511-b2stmyjs:22062:7)
Walker.visit (/tmp/execjs20150630-36511-b2stmyjs:22030:12)
TransformBindAttrToAttributes_transform [as transform] (/tmp/execjs20150630-36511-b2stmyjs:15518:12)
preprocess (/tmp/execjs20150630-36511-b2stmyjs:21637:27)
compileSpec (/tmp/execjs20150630-36511-b2stmyjs:16640:52)
["ok","(function() {\ ...
... locals: [],\n templates: []\n };\n}())"]'
(in /var/lib/jenkins/jobs/ch_master_package/workspace/app/assets/javascripts/templates/_permanently_remove_post.hbs)
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:68:in `extract_result'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:39:in `exec'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:21:in `eval'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:46:in `call'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/barber-0.9.0/lib/barber/precompiler.rb:23:in `compile'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/barber-0.9.0/lib/barber/precompiler.rb:8:in `compile'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/ember-rails-0.16.1/lib/ember/handlebars/template.rb:75:in `precompile_ember_handlebars'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/ember-rails-0.16.1/lib/ember/handlebars/template.rb:27:in `evaluate'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:12:in `initialize'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
/usr/local/rvm/gems/ruby-2.2.0@ch_master_package/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)