Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying 2.10 fails due to uglifier JS #3480

Closed
brchristian opened this issue Jan 19, 2020 · 4 comments
Closed

Deploying 2.10 fails due to uglifier JS #3480

brchristian opened this issue Jan 19, 2020 · 4 comments

Comments

@brchristian
Copy link
Contributor

I updated my Gemfile to Solidus ~> 2.10.0 and changed nothing else. All of my specs run fine in development. When I push to Heroku, the build fails with the message Precompiling assets failed. Push rejected, failed to compile Ruby app. Push failed.

Any idea what might be going on here?

The stack trace is the following:

remote:        Uglifier::Error: Unexpected token: punc ()). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
remote:        --
remote:         31160 
remote:         31161   onClick: function(e) {
remote:         31162     e.preventDefault()
remote:         31163     if (!confirm(Spree.translations.are_you_sure_delete)) {
remote:         31164       return;
remote:         31165     }
remote:         31166 
remote:         31167     this.model.empty({
remote:            =>       success: () => {
remote:         31169         this.collection.reset()
remote:         31170         this.collection.push({})
remote:         31171       }
remote:         31172     })
remote:         31173   },
remote:         31174 
remote:         31175   render: function() {
remote:         31176     var isNew = function (item) { return item.isNew() };
remote:        ==
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/solidus_backend-2.10.0/app/assets/config/solidus_backend_manifest.js:3
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:53:in `call'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:388:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:300:in `process_link_directive'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:180:in `block in process_directives'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in `each'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in `process_directives'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:83:in `_call'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:68:in `call'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in `block in find'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `each'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `find'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/airbrake-10.0.0/lib/airbrake/rake.rb:17:in `execute'
remote:        /tmp/build_3c79e0f35e2531d01e05ac60483b205d/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'

Solidus Version:
2.10.0

@kennyadsl
Copy link
Member

Maybe it's lautis/uglifier#127 (comment) ? Can you check which other gems have been updated in your Gemfile.lock?

@brchristian
Copy link
Contributor Author

Thank you for your help!

My Gemfile.lock shows that cancancan also updated. Not sure if that’s related.

At any rate, the change in lautis/uglifier#127 (comment) seems to have done the trick! I am closing this issue. Thank you again.

@pelargir
Copy link
Contributor

We ran into this same problem. Line 18 in backend/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js is the only line of JS that uses ES6 arrow syntax. When this line is corrected, Uglifier no longer has to be put into harmony mode to get Solidus to run properly. Line 18 should be changed back to ES5 syntax for better compatibility. There is no need to run Uglifier in harmony mode for this one line.

@spaghetticode
Copy link
Member

Fixed by #3511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants