web-dev-qa-db-fra.com

Erreur de déploiement Rails 5 Heroku: ExecJS :: ProgramError: SyntaxError: Jeton inattendu: nom (autoRegisterNamespace)

Lorsque j'essaie de déployer une application Rails 5 sur heroku, le message d'erreur suivant s'affiche: Running: rake assets:precompile:

remote:        ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace) (line: 14767, col: 7, pos: 457487)
remote:        Error
remote:        at new JS_Parse_Error (<eval>:3623:11948)
remote:        at js_error (<eval>:3623:12167)
remote:        at croak (<eval>:3623:21858)
remote:        at token_error (<eval>:3623:21995)
remote:        at unexpected (<eval>:3623:22083)
remote:        at semicolon (<eval>:3623:22601)
remote:        at simple_statement (<eval>:3623:25779)
remote:        at <eval>:3623:23567
remote:        at <eval>:3623:22774
remote:        at block_ (<eval>:3623:27903)
remote:        at <eval>:3623:23677
remote:        at <eval>:3623:22774
remote:        new JS_Parse_Error ((execjs):3623:11948)
remote:        js_error ((execjs):3623:12167)
remote:        croak ((execjs):3623:21858)
remote:        token_error ((execjs):3623:21995)
remote:        unexpected ((execjs):3623:22083)
remote:        semicolon ((execjs):3623:22601)
remote:        simple_statement ((execjs):3623:25779)
remote:        (execjs):3623:23567
remote:        (execjs):3623:22774
remote:        block_ ((execjs):3623:27903)
remote:        (execjs):3623:23677
remote:        (execjs):3623:22774
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:47:in `rescue in block in call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:44:in `block in call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:75:in `block in lock'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:73:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:73:in `Locker'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:73:in `lock'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:43:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/uglifier-3.0.1/lib/uglifier.rb:179:in `run_uglifyjs'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/uglifier-3.0.1/lib/uglifier.rb:141:in `compile'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:52:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `yield'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-Rails-3.1.1/lib/sprockets/Rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-Rails-3.1.1/lib/sprockets/Rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
remote:        V8::Error: SyntaxError: Unexpected token: name (autoRegisterNamespace)
remote:        at js_error (<eval>:3623:12167)
remote:        at croak (<eval>:3623:21858)
remote:        at token_error (<eval>:3623:21995)
remote:        at unexpected (<eval>:3623:22083)
remote:        at semicolon (<eval>:3623:22601)
remote:        at simple_statement (<eval>:3623:25779)
remote:        at <eval>:3623:23567
remote:        at <eval>:3623:22774
remote:        at block_ (<eval>:3623:27903)
remote:        at <eval>:3623:23677
remote:        at <eval>:3623:22774
remote:        at if_ (<eval>:3623:27671)
remote:        at <eval>:3623:24326
remote:        at <eval>:3623:22774
remote:        at block_ (<eval>:3623:27903)
remote:        at ctor.body (<eval>:3623:27506)
remote:        at function_ (<eval>:3623:27602)
remote:        at expr_atom (<eval>:3623:30888)
remote:        at maybe_unary (<eval>:3624:1562)
remote:        at expr_ops (<eval>:3624:2333)
remote:        at maybe_conditional (<eval>:3624:2425)
remote:        at maybe_assign (<eval>:3624:2868)
remote:        at expression (<eval>:3624:3194)
remote:        at expr_atom (<eval>:3623:30640)
remote:        at maybe_unary (<eval>:3624:1562)
remote:        at expr_ops (<eval>:3624:2333)
remote:        at maybe_conditional (<eval>:3624:2425)
remote:        at maybe_assign (<eval>:3624:2868)
remote:        at expression (<eval>:3624:3194)
remote:        at simple_statement (<eval>:3623:25762)
remote:        at <eval>:3623:23722
remote:        at <eval>:3623:22774
remote:        at block_ (<eval>:3623:27903)
remote:        at ctor.body (<eval>:3623:27506)
remote:        at function_ (<eval>:3623:27602)
remote:        at expr_atom (<eval>:3623:30888)
remote:        at maybe_unary (<eval>:3624:1562)
remote:        at expr_ops (<eval>:3624:2333)
remote:        at maybe_conditional (<eval>:3624:2425)
remote:        at maybe_assign (<eval>:3624:2868)
remote:        at expression (<eval>:3624:3194)
remote:        at expr_list (<eval>:3623:31368)
remote:        at subscripts (<eval>:3624:1271)
remote:        at expr_atom (<eval>:3623:30952)
remote:        at maybe_unary (<eval>:3624:1562)
remote:        at expr_ops (<eval>:3624:2333)
remote:        at maybe_conditional (<eval>:3624:2425)
remote:        at maybe_assign (<eval>:3624:2868)
remote:        at expression (<eval>:3624:3194)
remote:        at expr_atom (<eval>:3623:30640)
remote:        at maybe_unary (<eval>:3624:1562)
remote:        at expr_ops (<eval>:3624:2333)
remote:        at maybe_conditional (<eval>:3624:2425)
remote:        at maybe_assign (<eval>:3624:2868)
remote:        at expression (<eval>:3624:3194)
remote:        at simple_statement (<eval>:3623:25762)
remote:        at <eval>:3623:23722
remote:        at <eval>:3623:22774
remote:        at <eval>:3624:3569
remote:        at parse (<eval>:3624:3809)
remote:        at parse (<eval>:3958:22)
remote:        at uglifier (<eval>:4001:13)
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:45:in `block in call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:75:in `block in lock'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:73:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:73:in `Locker'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:73:in `lock'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/Ruby_racer_runtime.rb:43:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/uglifier-3.0.1/lib/uglifier.rb:179:in `run_uglifyjs'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/uglifier-3.0.1/lib/uglifier.rb:141:in `compile'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:52:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `yield'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-Rails-3.1.1/lib/sprockets/Rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/sprockets-Rails-3.1.1/lib/sprockets/Rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_371be96e0ec063bb6c90d7770da64944/vendor/bundle/Ruby/2.2.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)

Mon Gemfile ressemble à ceci:

source 'https://rubygems.org'

gem 'Rails', '~> 5.0.0'
gem 'pg'
gem 'puma', '~> 3.0'
gem 'httparty', '~> 0.14.0'

gem 'sass-Rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-Rails', '~> 4.2'
gem 'jquery-Rails', '~> 4.1', '>= 4.1.1'
gem 'haml-Rails', '~> 0.9.0'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.7'
gem 'owlcarousel-Rails', '~> 1.1', '>= 1.1.3.3'
gem 'font-awesome-Rails', '~> 4.6', '>= 4.6.3.1'


gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'

gem 'therubyracer'
gem 'execjs'

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

J'ai essayé les deux avec et sans:

gem 'therubyracer'
gem 'execjs'

Rien n'y fait. Exécuter des actifs de rake: précompiler localement sur mon mac fonctionne ...

15
Niels Kristian

Cela peut avoir un rapport avec la syntaxe javascript/coffescript. Vérifiez si vous avez let, le cri doit être remplacé par var.

28
Florin Ionce

Comme le dit la documentation officielle d'Uglifier ( https://github.com/lautis/uglifier ):

"Le support expérimental de la syntaxe ES6 peut être activé en passant l'option: harmony => true à l'option Uglifier."

Uglifier.compile(js, harmony: true)

Donc remplacez dans config/environments/production.rb.

config.assets.js_compressor = :uglifier

avec

config.assets.js_compressor = Uglifier.new(harmony: true)

10

J'ai aussi eu ce problème.

Il est important de rappeler que par défaut, Heroku précalcule dans un environnement de production. Lorsque vous exécutez rake assets:precompile localement, il s'agit généralement d'un environnement de développement, ce qui pour moi n'a pas posé le problème.

Donc, afin de reproduire le problème localement, essayez

Rails_ENV=production rake assets:precompile --trace

7
paws

Dans mon cas, j'utilise angularjs-Rails gem et comment le standard es6 est utilisé afin de le résoudre en commentant le compresseur uglifier dans le fichier config/environment/production.rb.

#config.assets.js_compressor = :uglifier
1
Vivek Singh

Il semble y avoir des problèmes avec la nouvelle syntaxe ES. De plus, Backtick ne pré-compilera pas.

mon exemple:

http://localhost:3000//${bike_file}.html

J'ai changé pour 

"http://localhost:3000//" + bike_file + ".html"

0
Jbur43

J'ai eu ce problème et il jetait Uglifier::Error: Unexpected token: name (subscription) 

Cela a fini par être une erreur de syntaxe réelle.

J'avais accidentellement laissé les mots "annuler l'abonnement" dans l'un de mes fichiers JS et cela le faisait jeter cette erreur

0
RickS