推送到heroku时出错

时间:2016-09-26 19:39:57

标签: javascript ruby-on-rails heroku deployment asset-pipeline

当我向heroku推送时,我遇到了这个错误,我不知道这意味着什么。它在本地运行良好,没有错误。

remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        ExecJS::RuntimeError: SyntaxError: Unexpected token: operator (>) (line: 3766, col: 54, pos: 255542)
remote:        Error
remote:        at new JS_Parse_Error (/tmp/execjs20160926-272-1dcsr5bjs:3623:11948)
remote:        at js_error (/tmp/execjs20160926-272-1dcsr5bjs:3623:12167)
remote:        at croak (/tmp/execjs20160926-272-1dcsr5bjs:3623:22038)
remote:        at token_error (/tmp/execjs20160926-272-1dcsr5bjs:3623:22175)
remote:        at unexpected (/tmp/execjs20160926-272-1dcsr5bjs:3623:22263)
remote:        at expr_atom (/tmp/execjs20160926-272-1dcsr5bjs:3623:31244)
remote:        at maybe_unary (/tmp/execjs20160926-272-1dcsr5bjs:3624:1752)
remote:        at expr_ops (/tmp/execjs20160926-272-1dcsr5bjs:3624:2523)
remote:        at maybe_conditional (/tmp/execjs20160926-272-1dcsr5bjs:3624:2615)
remote:        at maybe_assign (/tmp/execjs20160926-272-1dcsr5bjs:3624:3058)
remote:        at maybe_assign (/tmp/execjs20160926-272-1dcsr5bjs:3624:3232)
remote:        at expression (/tmp/execjs20160926-272-1dcsr5bjs:3624:3384)
remote:        at expr_list (/tmp/execjs20160926-272-1dcsr5bjs:3623:31548)
remote:        at subscripts (/tmp/execjs20160926-272-1dcsr5bjs:3624:1461)
remote:        new JS_Parse_Error ((execjs):3623:11948)
remote:        js_error ((execjs):3623:12167)
remote:        croak ((execjs):3623:22038)
remote:        token_error ((execjs):3623:22175)
remote:        unexpected ((execjs):3623:22263)
remote:        expr_atom ((execjs):3623:31244)
remote:        maybe_unary ((execjs):3624:1752)
remote:        expr_ops ((execjs):3624:2523)
remote:        maybe_conditional ((execjs):3624:2615)
remote:        maybe_assign ((execjs):3624:3058)
remote:        maybe_assign ((execjs):3624:3232)
remote:        expression ((execjs):3624:3384)
remote:        expr_list ((execjs):3623:31548)
remote:        subscripts ((execjs):3624:1461)
remote:        /tmp/build_49f5fc95a42160b27bfb23a9d4154294/vendor/bundle/ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'

我的application.js文件如下。

//= require jquery_ujs
//= require bootstrap-slider
//= require turbolinks
//= require RGraph.common.core
//= require RGraph.common.dynamic
//= require RGraph.common.tooltips
//= require RGraph.hprogress
//= require_tree .

我试图查找一些解决方案,但大多数问题涉及意外的令牌操作(<)而不是(>)。我不知道要在这里复制什么代码,因为我不知道问题在哪里,但我会在需要或要求时复制并粘贴我的代码。

1 个答案:

答案 0 :(得分:0)

最简单的解决方法是在heroku上转换资产编译并提交并推送已编译的资产。然而,它不是我更喜欢的解决方案,因为它给git历史增加了很多噪音,并且在部署时出现了乏味且容易出错的步骤。但如果你处于紧张状态,这可能就是你要走的路。

很难实际调试确切原因。在连接和缩小资产的过程中,管道正在创建一个错误的文件。

为了能够在不弄乱存储库的主分支或影响生产中的现有应用程序的情况下进行调试,您应该创建一个主题分支和一个单独的" staging"在heroku上的应用程序。

1。在git中创建一个主题分支

git checkout -b fix-assets-issue

2。设置Heroku登台应用程序

创建新的app via the web GUI或CLI:

heroku create myapp-staging --remote staging 

3。将您的主题分支推送到登台主分支

git push staging fix-assets-issue:master

这可能会像以前的尝试一样失败。

4。缩小问题集。

尝试"评论"来自链轮宣言的所有指令。 (链轮仅处理从//=开始的行)

//#= require jquery_ujs
//#= require bootstrap-slider
//#= require turbolinks
//#= require RGraph.common.core
//#= require RGraph.common.dynamic
//#= require RGraph.common.tooltips
//#= require RGraph.hprogress
//#= require_tree .

提交并推送。 (见#3)

逐个重新添加它们,直到找到错误原因。承诺并推动。 (见#3)

找到问题的根源后,检查github上的依赖项是否存在问题,或者您使用的是最新版本。