Heroku推送-ExecJS :: RuntimeError:SyntaxError:预期名称 [英] Heroku push - ExecJS::RuntimeError: SyntaxError: Name expected

查看:87
本文介绍了Heroku推送-ExecJS :: RuntimeError:SyntaxError:预期名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

推送到Heroku时遇到以下错误.前几天工作正常.我尝试推送的提交没有重大配置更改.我很困惑如何解决此问题. Rails 5.1应用程序使用以下构建包:

I am encountering the following error when pushing to Heroku. Was working fine the other day. No major configuration changes on the commit I'm trying to push. I'm stumped at how to troubleshoot this. The Rails 5.1 application uses the following buildpacks:

1. heroku/nodejs
2. heroku/ruby

我正在使用卷筒纸和纱线.我认为这与它有关,但是在挖掘更多信息时遇到了麻烦.

I'm making use of webpacker and yarn. I think that has something to do with it but having trouble digging for more information.

remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v0.27.5
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        warning fsevents@1.1.2: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        [4/4] Building fresh packages...
remote:        Done in 6.62s.
remote:        rake aborted!
remote:        ExecJS::RuntimeError: SyntaxError: Name expected
remote:        JS_Parse_Error.get ((execjs):3538:621)
remote:        (execjs):4060:47
remote:        (execjs):1:102
remote:        Object.<anonymous> ((execjs):1:120)
remote:        Module._compile (module.js:571:32)
remote:        Object.Module._extensions..js (module.js:580:10)
remote:        Module.load (module.js:488:32)
remote:        tryModuleLoad (module.js:447:12)
remote:        Function.Module._load (module.js:439:3)
remote:        Module.runMain (module.js:605:10)
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/uglifier-3.2.0/lib/uglifier.rb:195:in `run_uglifyjs'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/uglifier-3.2.0/lib/uglifier.rb:157:in `compile'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:53:in `call'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected ....

经进一步研究,发现该问题与Uglifier有关.当我将第三方库datepicker.js的内容复制并粘贴到Uglifier中时,会出现相同的错误:

Upon further research, discovered the problem to be related to Uglifier. When I copy and paste the contents of third party library datepicker.js into Uglifier I get the same error:

> Uglifier.compile( <<< file contents >>> )
ExecJS::RuntimeError: SyntaxError: Name expected
from JS_Parse_Error.get ((execjs):3538:621)

推荐答案

我发现,此问题的原因与Uglifier尝试处理名为js-datepicker(datepicker.js)的第三方库时可能的错误有关. ).我在Uglifier Github上打开了一个问题: https://github.com/lautis/uglifier/Issues/124

I discovered that the cause of this issue is related to a possible bug in Uglifier when it tries to process a third party library named js-datepicker (datepicker.js). I opened up an issue on the Uglifier Github: https://github.com/lautis/uglifier/issues/124

通过在我的app/assets/javascripts/application.js文件中包含缩小的js-datepicker,我找到了解决此问题的方法.

I figured out a workaround for this by including the minified js-datepicker in my app/assets/javascripts/application.js file like this.

//= require js-datepicker/datepicker.min

这篇关于Heroku推送-ExecJS :: RuntimeError:SyntaxError:预期名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆