简体   繁体   English

Heroku红宝石Rails 4与heroku ExecJS :: ProgramError:意外令牌:错误

[英]Heroku ruby rails 4 with heroku ExecJS::ProgramError: Unexpected token: error

Hey guys im trying to deploy my ruby on rails 4 app on Heroku but having a problem on execution. 大家好,我试图在Heroku的Rails 4应用程序上部署我的红宝石,但执行时遇到问题。 Im using sqlite3 and I have tried everything. 我正在使用sqlite3,我已经尝试了所有方法。

This is the error on the last stage: 这是最后阶段的错误:

remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! 远程:----->为Rails资产管道远程准备应用程序:正在运行:rake资产:预编译远程:rake中止了! remote: ExecJS::ProgramError: Unexpected token: operator (<<) (line: 16, col: 0, pos: 391) remote: Error remote: at new JS_Parse_Error (/tmp/execjs20150126-932-1636928js:2359:10623) remote: at js_error (/tmp/execjs20150126-932-1636928js:2359:10842) remote: at croak (/tmp/execjs20150126-932-1636928js:2359:19086) remote: at token_error (/tmp/execjs20150126-932-1636928js:2359:19223) remote: at unexpected (/tmp/execjs20150126-932-1636928js:2359:19311) remote: at expr_atom (/tmp/execjs20150126-932-1636928js:2359:27526) remote: at maybe_unary (/tmp/execjs20150126-932-1636928js:2359:30019) remote: at expr_ops (/tmp/execjs20150126-932-1636928js:2359:30777) remote: at maybe_conditional (/tmp/execjs20150126-932-1636928js:2359:30869) remote: at maybe_assign (/tmp/execjs20150126-932-1636928js:2359:31312) remote: (in /tmp/build_c9b90b740808f1b53c01e698e6740e18/app/assets/javascripts/app.js.orig)/tmp/build_c9b90b740808f1b53c01e698e6740e18/vendor/bundle/ruby/2.0.0/gems/execjs-2.2.2/lib/execjs/externa 远程:ExecJS :: ProgramError:意外的令牌:运算符(<<)(行:16,col:0,pos:391)远程:错误远程:在新的JS_Parse_Error(/ tmp / execjs20150126-932-1636928js:2359:10623)远程:在js_error(/ tmp / execjs20150126-932-1636928js:2359:10842)远程:在croak(/ tmp / execjs20150126-932-1636928js:2359:19086)远程:在token_error(/ tmp / execjs20150126-932-1636928js: 2359:19223)远程:在意外(/ tmp / execjs20150126-932-1636928js:2359:19311)远程:在expr_atom(/ tmp / execjs20150126-932-1636928js:2359:27526)远程:在maybe_unary(/ tmp / execjs20150126- 932-1636928js:2359:30019)远程:at expr_ops(/ tmp / execjs20150126-932-1636928js:2359:30777)远程:atmay_conditional(/ tmp / execjs20150126-932-1636928js:2359:30869)远程:atmay_assign(/ tmp / execjs20150126-932-1636928js:2359:31312)远程:(在/tmp/build_c9b90b740808f1b53c01e698e6740e18/app/assets/javascripts/app.js.orig)/tmp/build_c9b90b740808f1b53c01e698e6740e18/rud/ms//2 execjs-2.2.2 / lib / execjs / externa l_runtime.rb:64:in `extract_result' remote: /tmp/build_c9b90b740808f1b53c01e698e6740e18/vendor/bundle l_runtime.rb:64:在`extract_result'远程中:/ tmp / build_c9b90b740808f1b53c01e698e6740e18 / vendor / bundle

my application.js: 我的application.js:

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery-ui

gemfile: gemfile:

group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end

at the moment when I run this command: 在我运行以下命令时:

 bundle exec rake --trace assets:precompile

I get: 我得到:

** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile

But before I got something different which told me to go into public/assets/(a really long ass file name).js right next to the execution assets:precompile. 但是在我得到一些不同的通知之前,要告诉我进入执行资产:预编译旁边的public / assets /(一个很长的屁股文件名).js。 When I went into the file, it did have a few "<<". 当我进入文件时,它确实有一些“ <<”。 It was generated by foundation I think but I dont wanna touch anything. 我想它是由基金会产生的,但我不想触摸任何东西。

I was facing this issue as well. 我也面临这个问题。 I found that multiline comments can cause this issue as well. 我发现多行注释也可能导致此问题。

<!-- -->

This is a wrong syntax for multiline comments in js hence all the trouble. 这是js中多行注释的语法错误,因此很麻烦。

These should be replaced with // comments 这些应替换为//注释

This fixed the issue for me. 这为我解决了这个问题。

And in order to find the issue, I had to run assets precompile task locally with development first, sprockets did not try to compress the file and it went through, then I could go to the line number to find the comment that was causing all the trouble. 为了找到问题,我必须先在本地运行资产预编译任务,然后进行开发,链轮程序并没有尝试压缩文件,而是通过了该文件,然后我可以转到行号以查找引起所有问题的注释。麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Heroku ExecJS :: ProgramError:意外令牌:错误导轨 - Heroku ExecJS::ProgramError: Unexpected token: error rails ExecJS :: ProgramError:意外字符“#” - ExecJS::ProgramError: Unexpected character '#' 对用于Rails部署的Heroku ExecJS程序错误进行故障排除 - Troubleshooting Heroku ExecJS Program Error for Rails deployment 将Rails应用程序部署到Heroku时出现语法错误:ExecJS :: RuntimeError:SyntaxError:Unexpected character - Syntax error when deploying Rails app to Heroku: ExecJS::RuntimeError: SyntaxError: Unexpected character git:ExecJS :: ProgramError:意外的令牌:推送到生产环境时的名称(jquery) - git: ExecJS::ProgramError: Unexpected token: name (jquery) when push to production environment ExecJS::ProgramError: 运行 rake 资产时出现意外的标记 punc «(»,预期的 punc «:»:在生产中预编译 - ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» when running rake assets:precompile on production Heroku部署错误Ruby在Rails上 - heroku deployment error ruby on rails Heroku 意外令牌??== - Heroku Unexpected Token ??== ExecJS :: ProgramError:尝试为生产预编译资产时出现意外字符&#39;#&#39; - ExecJS::ProgramError: Unexpected character '#' when trying to precompile assets for production Heroku SyntaxError:意外的标记“导出” - Heroku SyntaxError: Unexpected token 'export'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM