【问题标题】:Error while pushing to heroku推送到heroku时出错
【发布时间】:2016-09-26 19:39:56
【问题描述】:

当我推送到 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 .

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

【问题讨论】:

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


【解决方案1】:

最简单的解决方法是在 heroku 上打开资产编译并提交和推送已编译的资产。然而,它不是我更喜欢的解决方案,因为它给 git 历史添加了很多噪音,并且部署的步骤繁琐且容易出错。但是,如果您在时间紧迫的情况下,这可能是要走的路。

很难真正调试确切的原因可能是什么。在连接和缩小资产的过程中的某个地方,管道正在创建一个坏文件。

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

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

git checkout -b fix-assets-issue

2。设置 Heroku 登台应用程序

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

heroku create myapp-staging --remote staging 

3。将您的主题分支推送到 staging master 分支

git push staging fix-assets-issue:master

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

4。缩小问题集。

尝试“注释掉” sprockets 宣言中的所有指令。 (链轮只会处理以//= 开头的行)

//#= 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 上是否存在问题,或者您使用的是最新版本。

【讨论】:

  • 这个答案实际上并不包含对潜在问题的修复,但应该可以帮助您缩小原因。
猜你喜欢
  • 1970-01-01
  • 2011-12-13
  • 2011-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-31
  • 2017-07-14
  • 2018-07-18
相关资源
最近更新 更多