Los activos de precompilation fallaron ExecJS :: ProgramError: Token inesperado: operator (=) (línea: 10770, col: 0, pos: 300859)

Estoy teniendo problemas para impulsar mi proyecto de carriles a heroku. Aparece el post "Precompilation de activos fallidos". Soy nuevo en progtwigción y nuevo en ruby ​​on rails. Realmente necesito ayuda. Aquí está el text de mi línea de command.

$ git push heroku master Counting objects: 76, done. Compressing objects: 100% (63/63), done. Writing objects: 100% (76/76), 27.38 KiB | 11.00 KiB/s, done. Total 76 (delta 4), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.0.0 remote: ###### WARNING: remote: Removing `Gemfile.lock` because it was generated on Windows. remote: Bundler will do a full resolve so native gems are handled properl y. remote: This may result in unexpected gem versions being used in your app . remote: In rare occasions Bundler may not be able to resolve your depende ncies at all. remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile remote: remote: -----> Installing dependencies using 1.9.7 remote: Running: bundle install --without development:test --path vendor/ bundle --binstubs vendor/bundle/bin -j4 remote: Fetching gem metadata from https://rubygems.org/............ remote: Fetching version metadata from https://rubygems.org/... remote: Fetching dependency metadata from https://rubygems.org/.. remote: Resolving dependencies.... remote: Rubygems 2.0.14 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem insta llation. remote: Installing rake 10.4.2 remote: Installing i18n 0.7.0 remote: Installing multi_json 1.11.0 remote: Installing activesupport 3.2.21 remote: Installing builder 3.0.4 remote: Installing activemodel 3.2.21 remote: Installing erubis 2.7.0 remote: Installing journey 1.0.4 remote: Installing rack 1.4.5 remote: Installing rack-cache 1.2 remote: Installing rack-test 0.6.3 remote: Installing hike 1.2.3 remote: Installing tilt 1.4.1 remote: Installing sprockets 2.2.3 remote: Installing actionpack 3.2.21 remote: Installing mime-types 1.25.1 remote: Installing polyglot 0.3.5 remote: Installing treetop 1.4.15 remote: Installing mail 2.5.4 remote: Installing actionmailer 3.2.21 remote: Installing arel 3.0.3 remote: Installing tzinfo 0.3.44 remote: Installing activerecord 3.2.21 remote: Installing activeresource 3.2.21 remote: Using bundler 1.9.7 remote: Installing coffee-script-source remote: Installing execjs 2.5.2 remote: Installing coffee-script 2.4.1 remote: Installing rack-ssl 1.3.4 remote: Installing json 1.8.2 remote: Installing rdoc 3.12.2 remote: Installing thor 0.19.1 remote: Installing railties 3.2.21 remote: Installing coffee-rails 3.2.2 remote: Installing jquery-rails 3.1.2 remote: Installing pg 0.18.2 remote: Installing rails 3.2.21 remote: Installing sass 3.4.14 remote: Installing sass-rails 3.2.6 remote: Installing uglifier 2.7.1 remote: Bundle complete! 6 Gemfile dependencies, 40 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into ./vendor/bundle. remote: Post-install message from rdoc: remote: Depending on your version of ruby, you may need to install ruby r doc/ri data: remote: <= 1.8.6 : unsupported remote: = 1.8.7 : gem install rdoc-data; rdoc-data --install remote: = 1.9.1 : gem install rdoc-data; rdoc-data --install remote: >= 1.9.2 : nothing to do! Yay! remote: Bundle completed (54.39s) remote: Cleaning up the bundler cache. remote: -----> Writing config/database.yml to read from DATABASE_URL remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/p lugins! Support for these plugins will be removed in Rails 4.0. Move them out an d bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http:/ /weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (requinetworking)> at /tmp/build_7f6590528210ec3b45a43e69c0119446/Rakefile:7) remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/p lugins! Support for these plugins will be removed in Rails 4.0. Move them out an d bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http:/ /weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (requinetworking)> at /tmp/build_7f6590528210ec3b45a43e69c0119446/Rakefile:7) remote: rake aborted! remote: ExecJS::ProgramError: Unexpected token: operator (=) (line: 10770 , col: 0, pos: 300859) remote: Error remote: at new JS_Parse_Error (/tmp/execjs20150523-743-1p3uckwjs:2359:106 23) remote: at js_error (/tmp/execjs20150523-743-1p3uckwjs:2359:10842) remote: at croak (/tmp/execjs20150523-743-1p3uckwjs:2359:19086) remote: at token_error (/tmp/execjs20150523-743-1p3uckwjs:2359:19223) remote: at unexpected (/tmp/execjs20150523-743-1p3uckwjs:2359:19311) remote: at expr_atom (/tmp/execjs20150523-743-1p3uckwjs:2359:27526) remote: at maybe_unary (/tmp/execjs20150523-743-1p3uckwjs:2359:30019) remote: at expr_ops (/tmp/execjs20150523-743-1p3uckwjs:2359:30777) remote: at maybe_conditional (/tmp/execjs20150523-743-1p3uckwjs:2359:3086 9) remote: at maybe_assign (/tmp/execjs20150523-743-1p3uckwjs:2359:31312) remote: at expression (/tmp/execjs20150523-743-1p3uckwjs:2359:31625) remote: at simple_statement (/tmp/execjs20150523-743-1p3uckwjs:2359:22563 ) remote: at /tmp/execjs20150523-743-1p3uckwjs:2359:20468 remote: (in /tmp/build_7f6590528210ec3b45a43e69c0119446/app/assets/javasc ripts/application.js)new JS_Parse_Error ((execjs):2359:10623) remote: js_error ((execjs):2359:10842) remote: croak ((execjs):2359:19086) remote: token_error ((execjs):2359:19223) remote: unexpected ((execjs):2359:19311) remote: expr_atom ((execjs):2359:27526) remote: maybe_unary ((execjs):2359:30019) remote: expr_ops ((execjs):2359:30777) remote: maybe_conditional ((execjs):2359:30869) remote: maybe_assign ((execjs):2359:31312) remote: expression ((execjs):2359:31625) remote: simple_statement ((execjs):2359:22563) remote: (execjs):2359:20468 remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:39:in `exec' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:21:in `eval' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:46:in `call' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/uglifier-2.7.1/lib/uglifier.rb:212:in `run_uglifyjs' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/uglifier-2.7.1/lib/uglifier.rb:179:in `compile' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/compressors.rb:74:in `compress' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/processing.rb:265:in `block in js_compres sor=' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/processor.rb:29:in `call' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/processor.rb:29:in `evaluate' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/context.rb:193:in `block in evaluate' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/context.rb:190:in `each' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/context.rb:190:in `evaluate' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/bundled_asset.rb:26:in `initialize' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:252:in `new' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:252:in `build_asset' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/static_compiler.rb:19:in `block in comp ile' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:219:in `block in each_logical_pat h' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:206:in `block (2 levels) in each_ file' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:196:in `each' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:196:in `each_entry' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:204:in `block in each_file' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:203:in `each' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:203:in `each_file' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:217:in `each_logical_path' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/static_compiler.rb:18:in `compile' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:56:in `internal_precompile' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (requinetworking)>' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (requinetworking)>' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rak e_task' remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2. 0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (requinetworking)>' remote: Tasks: TOP => assets:precompile:primary remote: (See full trace by running task with --trace) remote: ! remote: ! Precompiling assets failed. remote: ! remote: remote: ! Push rejected, failed to compile Ruby app remote: remote: Verifying deploy... remote: remote: ! Push rejected to whispering-chamber-4883. remote: To https://git.heroku.com/whispering-chamber-4883.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/whispering-chamber-48 83.git' 


Probablemente ya haya resuelto esto, pero tropecé con este problema y quería compartir mi solución.

Como se sugirió anteriormente, la mejor forma de rastrear el error hasta el file problemático es ejecutar

rake assets:precompile RAILS_ENV=production

localmente al excluir files o directorys que podría pensar que contienen el problema. Borré directorys uno por uno (que luego pude volver a sacar de mi repository) hasta que se ejecutó la precompilation. Luego profundicé en el último directory eliminado y lo rastreé hasta cierto file y una function de la forma

 array.find(name => name.id === user_id); 

Mi investigación demostró que la mayor actualización de Javascript (ES5) se lanzó en 2009 y, desde entonces, solo en junio de 2015 se publicó la especificación final ECMAScript 6 (ES6). La syntax utilizada en esta function es soportada por ES6 pero no ES5 y ES6 aún no es compatible con Rails (estaba ejecutando RoR, al less no con ExecJS en la canalización de activos.

Lo que PUEDE hacer, es cambiar su function a una syntax alternativa, es decir

 array.find(function(name){return name.id === user_id}); 

y debería funcionar de manera equivalente.

  • Más sobre la function find aquí
  • Para que ES6 funcione en RoR, es posible que desees consultar Babel , como se describe aquí

Tuve un problema muy similar en el que no me dejaba precomstackr debido a un (>). Básicamente rastreé el file ofensivo eliminando diferentes files y viendo si una precompilation funcionaría. Eventrually lo rastreé hasta este método:

 tagIsUnique: function(){ return this.tags.findIndex( item => this.tag.toLowerCase() === item.toLowerCase() ) < 0; } 

y luego lo cambié para que ya no tuviera la flecha ofensiva.

El post de error indica que uno de sus files JavaScript (o CoffeeScript) tiene un error de syntax. Lamentablemente, el post no le brinda suficiente información para ubicar el activo y el número de línea correctos. Sin embargo, puede networkingucir su búsqueda precomstackndo localmente con

rake assets:precompile

Que debería dar salida a algo similar a

 ExecJS::RuntimeError: Unexpected token: operator (=) (in /path/to/railsapp/app/assets/javascripts/path/to/asset.js) ... 

Esto indica que el error está en la path/to/asset.js del file path/to/asset.js . Sin saber el contenido de este file, solo puedo adivinar que tiene un error = en algún lugar allí. Eche un vistazo más de cerca a ese file y vea si algo parece fuera de lugar.

Tenga en count que ejecuta rake assets:precompile local generará activos en public/assets/ . No desea verificarlos en su repository de git, asegúrese de eliminarlos antes de enviar su corrección al file de activos roto.

Busque operator = en su JavaScript. Probablemente encuentre error tipográfico con = entonces.

remoto: ¡rake abortado! remote: ExecJS :: ProgramError: Token inesperado: operator (=) (línea: 10770, col: 0, pos: 300859)