本文介绍了预编译资产失败ExecJS :: ProgramError:意外的标记:运算符(=)(行:10770,col:0,pos:300859)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我遇到了将我的rails项目推向heroku的问题。我收到预编译资产失败消息。我是编程新手,而且是Ruby on Rails的新手。我真的需要一些帮助。 $ git push heroku master 计数对象:76,完成。 压缩对象:100%(63/63),完成。 写作对象:100%(76/76),27.38 KiB | 11.00 KiB / s,完成。 总计76(增量4),重用0(增量0)远程:压缩源文件...完成。 remote:建筑来源: remote: remote:-----> Ruby应用检测到 remote:----->编译Ruby / Rails remote:----->使用Ruby版本:ruby-2.0.0 remote:######警告: remote:删除`Gemfile.lock`,因为它是在Windows上生成的。 remote:Bundler会做一个完整的解决方案,所以原生gem将被处理为 y。 remote:这可能会导致在应用程序中使用意外的gem版本。 remote:在极少数情况下,Bundler可能无法解决您的依赖 ncies。 remote:https://devcenter.heroku.com/articles/bundler-windows-gemfile remote: remote:----->使用1.9.7安装依赖项 remote:运行:bundle install --without development:test --path vendor / bundle --binstubs vendor / bundle / bin -j4 remote:获取gem元数据来自https://rubygems.org / ............ remote:从https://rubygems.org / ...获取版本元数据 remote:获取依赖关系元数据来自https://rubygems.org/ .. remote:解决依赖关系.... remote:Rubygems 2.0.14不是线程安全的,因此您的宝石必须安装 one一次。升级到Rubygems 2.1.0或更高版本以启用并行gem insta 升级。 remote:安装rake 10.4.2 remote:安装i18n 0.7.0 remote:安装multi_json 1.11.0 remote:安装activesupport 3.2.21 remote:安装生成器3.0.4 remote:安装activemodel 3.2.21 remote:安装erubis 2.7.0 remote:安装旅程1.0.4 remote:安装机架1.4.5 remote:安装机架高速缓存1.2 remote:安装机架测试0.6.3 remote:安装远程机器人1.2.3 remote:安装倾斜机器人1.4.1 remote :安装链轮2.2.3 remote:安装actionpack 3.2.21 remote:安装mime-types 1.25.1 remote:安装polyglot 0.3.5 remote:安装treetop 1.4 .15 remote:安装邮件2.5.4 remote:安装actionmailer 3.2.21 remote:安装arel 3.0.3 remote:安装tzinfo 0 .3.44 remote:安装activerecord 3.2.21 remote:安装活动资源3.2.21 remote:使用bundler 1.9.7 remote:安装coffee-script-source 1.9.1.1 remote:安装execjs 2.5.2 remote:安装coffee-script 2.4.1 remote:安装rack-ssl 1.3.4 remote:安装json 1.8.2 remote:安装rdoc 3.12.2 remote:安装thor 0.19.1 remote:安装railties 3.2.21 remote:安装咖啡栏3.2.2 remote:安装jquery-rails 3.1.2 remote:安装pg 0.18.2 remote:安装rails 3.2.21 remote:安装sass 3.4.14 remote:安装sass-rails 3.2.6 remote:安装uglifier 2.7.1 remote:捆绑包完成! 6个Gemfile依赖项,现在安装了40个宝石。 remote:群组开发和测试中的宝石没有安装。 remote:捆绑的gems被安装到./vendor/bundle中。 remote:来自rdoc的安装后信息: remote:根据您的ruby版本,您可能需要安装ruby r doc / ri data: remote:< = 1.8.6:不支持 remote:= 1.8.7:gem install rdoc-data; rdoc-data --install remote:= 1.9.1:gem install rdoc-data; rdoc-data --install remote:> = 1.9.2:无所事事!好极了! remote:捆绑完成(54.39s) remote:清理捆绑缓存。 remote:----->编写config / database.yml以从DATABASE_URL读取 remote:----->为Rails资产管道准备应用程序 remote:运行:rake资产:预编译 remote:DEPRECATION警告:在供应商/ p lugins中有Rails 2.3风格的插件!在Rails 4.0中将会删除对这些插件的支持。将它们移出 d将它们捆绑到您的Gemfile中,或者将它们作为lib / myplugin / *和 config / initializers / myplugin.rb折叠到您的应用中。有关详情,请参阅发行说明:http:/ /weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released。 (在$ t $ b< top(required)> / attmp / build_7f6590528210ec3b45a43e69c0119446 / Rakefile中调用:7) remote:DEPRECATION警告:您在供应商/ p lugins中有Rails 2.3风格的插件!在Rails 4.0中将会删除对这些插件的支持。将它们移出 d将它们捆绑到您的Gemfile中,或者将它们作为lib / myplugin / *和 config / initializers / myplugin.rb折叠到您的应用中。有关详情,请参阅发行说明:http:/ /weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released。 (从 在/ tmp / build_7f6590528210ec3b45a43e69c0119446 / Rakefile中调用:7) remote:rake aborted! remote:ExecJS :: ProgramError:意外的标记:操作符(=)(行:10770 ,col:0,pos:300859) remote:错误 remote:at new JS_Parse_Error(/ tmp / execjs20150523-743-1p3uckwjs:2359:106 23) remote:在js_error(/ tmp / execjs20150523-743-1p3uckwjs:2359:10842) remote:在croak (/ tmp / execjs20150523-743-1p3uckwjs:2359:19086) remote:at token_error(/ tmp / execjs20150523-743-1p3uckwjs:2359:19223) remote:at unexpected(/ tmp / execjs20150523- remote:at expr_atom(/ tmp / execjs20150523-743-1p3uckwjs:2359:27526) remote:at maybe_unary(/ tmp / execjs20150523-743-1p3uckwjs:2359: 30019) remote:at expr_ops(/ tmp / execjs20150523-743-1p3uckwjs:2359:30777) remote:at maybe_conditional(/ tmp / execjs20150523-743-1p3uckwjs:2359:3086 9 ) remote:at maybe_assign(/ tmp / execjs20150523-743-1p3uckwjs:2359:31312) remote:at expres sion(/ tmp / execjs20150523-743-1p3uckwjs:2359:31625) remote:at simple_statement(/ tmp / execjs20150523-743-1p3uckwjs:2359:22563 ) remote:at / tmp / execjs20150523-743-1p3uckwjs:2359:20468 remote:(in / tmp / build_7f6590528210ec3b45a43e69c0119446 / app / assets / javasc ripts / application.js)new JS_Parse_Error((execjs):2359:10623) remote:js_error((execjs):2359:10842) remote:croak((execjs):2359:19086) remote:token_error((execjs):2359:19223) b remote:unexpected((execjs):2359:19311) remote:expr_atom((execjs):2359:27526) remote:maybe_unary((execjs):2359:30019) remote : remote:maybe_conditional((execjs):2359:30869) remote:maybe_assign((execjs):2359:31312) remote:表达式:expr_ops((execjs):2359:30777) ((execjs):2359:31625) remote:simple_statement((execjs):2359:22563) remote:(execjs):2359:20468 远程:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / execjs-2.5.2 / lib / execjs / external_runtime.rb:39:在`exec' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / execjs-2.5.2 / lib / execjs / external_runtime.rb:21:在`eval' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / execjs-2.5.2 / lib / execjs / external_runtime.rb:46:在`call' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / uglifier-2.7.1 / lib / uglifier.rb:212:在`run_uglifyjs' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / uglifier-2.7.1 / lib / uglifier.rb:179:在`compile' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / compressors.rb:74:在`compress' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / processing.rb:265:in`block in js_compres sor =' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle /红宝石/ 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / processor.rb:29:在`call' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / processor.rb:29:在`evaluate' remote:/tmp/build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / tilt-1.4.1 / lib / tilt / template.rb:103:在`render' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / context.rb:193:在`block in evaluate' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / context.rb:190:在`each' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / context.rb:190:在`evaluate' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / bundled_asset.rb:26:在`initialize' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:252:在`new' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:252:在`build_asset' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / index.rb:93:在`block in build_asset' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / caching.rb:19:在`cache_asset' remote:/tmp/build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / index.rb:92:在`build_asset' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:169:在`find_asset' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / index.rb:60:在`find_asset' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / static_compiler.rb:19:在`block in comp ile' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle /红宝石/ 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:219:在`block in each_logical_pat h' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle /红宝石/ 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:206:在每个文件中的块(2级)中 remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 /供应商/束/红宝石/ 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:196:在`each' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:196:在'each_entry'中 remote:/tmp/build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:204:在``block'in each_file' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:203:在`each' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:203:在`each_file' remote:/tmp/build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / sprockets-2.2.3 / lib / sprockets / base.rb:217:在`each_logical_path' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / static_compiler.rb:18:在`compile' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / assets.rake:56:在`internal_precompile' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2 。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / assets.rake:70:在中的块(3个级别)顶部(必需)>'远程:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / assets.rake:60:在中的块(3个级别)顶部(必需)>'远程:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / assets.rake:23:在`invoke_or_reboot_rak e_task' remote:/ tmp / build_7f6590528210ec3b45a43e69c0119446 / vendor / bundle / ruby​​ / 2。 0.0 / gems / actionpack-3.2.21 / lib / sprockets / assets.rake:29:在中的block(2个级别)b ' remote :任务:TOP => assets:precompile:primary remote:(通过使用--trace运行任务来查看完整跟踪) remote:! remote:!预编译资产失败。 remote:! remote: remote:!推送被拒绝,未能编译Ruby应用程序 remote: remote:正在验证部署... remote: remote:!推拒绝耳语室4883。 remote:至https://git.heroku.com/whispering-chamber-4883.git ! [remote rejected] master - >主人(预先接收钩子拒绝)错误:未能将一些裁判推送到'https://git.heroku.com/whispering-chamber-48 83.git' 解决方案您现在可能已经解决了这个问题,但我偶然发现了这个问题,并想分享我的解决方案。 作为上述建议的答案,跟踪有问题文件的错误的最好方法是运行 rake资产:预编译RAILS_ENV =生产 本地排除可能认为包含问题的文件或目录。我一个接一个地删除目录(之后我可以从我的repo中再次签出)直到我开始预编译运行。然后我钻入最后一个被删除的目录,并将其追踪到某个文件和一个形式函数中。 $ b $ pre $ array.find (name => name.id === user_id); 我的调查结果显示,最新的Javascript(ES5)于2009年发布,那么,2015年6月仅unitl发布了ECMAScript 6(ES6)最终规范。此功能中使用的语法由ES6支持,但ES5和ES6在Rails(我正在运行RoR 5.0.0.1)时尚未支持,至少不支持资产管道上的ExecJS。 你可以做的是将你的函数改为另一种语法,即 array.find(function(name){return name.id === user_id}); 并且它应该等效地工作。 更多关于 find 功能 here 要让ES6在RoR上工作,您可能需要查看 Babel ,如 here I am having issues pushing my rails project to heroku. I get a "Precompiling assets failed" message . I am new to programming and new to ruby on rails. I really need some help. Here is the text from my command line. $ git push heroku masterCounting objects: 76, done.Compressing objects: 100% (63/63), done.Writing objects: 100% (76/76), 27.38 KiB | 11.00 KiB/s, done.Total 76 (delta 4), reused 0 (delta 0)remote: Compressing source files... done.remote: Building source:remote:remote: -----> Ruby app detectedremote: -----> Compiling Ruby/Railsremote: -----> Using Ruby version: ruby-2.0.0remote: ###### WARNING:remote: Removing `Gemfile.lock` because it was generated on Windows.remote: Bundler will do a full resolve so native gems are handled properly.remote: This may result in unexpected gem versions being used in your app.remote: In rare occasions Bundler may not be able to resolve your dependencies at all.remote: https://devcenter.heroku.com/articles/bundler-windows-gemfileremote:remote: -----> Installing dependencies using 1.9.7remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4remote: Fetching gem metadata from https://rubygems.org/............remote: Fetching version metadata from https://rubygems.org/...remote: Fetching dependency metadata from https://rubygems.org/..remote: Resolving dependencies....remote: Rubygems 2.0.14 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.remote: Installing rake 10.4.2remote: Installing i18n 0.7.0remote: Installing multi_json 1.11.0remote: Installing activesupport 3.2.21remote: Installing builder 3.0.4remote: Installing activemodel 3.2.21remote: Installing erubis 2.7.0remote: Installing journey 1.0.4remote: Installing rack 1.4.5remote: Installing rack-cache 1.2remote: Installing rack-test 0.6.3remote: Installing hike 1.2.3remote: Installing tilt 1.4.1remote: Installing sprockets 2.2.3remote: Installing actionpack 3.2.21remote: Installing mime-types 1.25.1remote: Installing polyglot 0.3.5remote: Installing treetop 1.4.15remote: Installing mail 2.5.4remote: Installing actionmailer 3.2.21remote: Installing arel 3.0.3remote: Installing tzinfo 0.3.44remote: Installing activerecord 3.2.21remote: Installing activeresource 3.2.21remote: Using bundler 1.9.7remote: Installing coffee-script-source 1.9.1.1remote: Installing execjs 2.5.2remote: Installing coffee-script 2.4.1remote: Installing rack-ssl 1.3.4remote: Installing json 1.8.2remote: Installing rdoc 3.12.2remote: Installing thor 0.19.1remote: Installing railties 3.2.21remote: Installing coffee-rails 3.2.2remote: Installing jquery-rails 3.1.2remote: Installing pg 0.18.2remote: Installing rails 3.2.21remote: Installing sass 3.4.14remote: Installing sass-rails 3.2.6remote: Installing uglifier 2.7.1remote: Bundle complete! 6 Gemfile dependencies, 40 gems now installed.remote: Gems in the groups development and test were not installed.remote: Bundled gems are installed into ./vendor/bundle.remote: Post-install message from rdoc:remote: Depending on your version of ruby, you may need to install ruby rdoc/ri data:remote: <= 1.8.6 : unsupportedremote: = 1.8.7 : gem install rdoc-data; rdoc-data --installremote: = 1.9.1 : gem install rdoc-data; rdoc-data --installremote: >= 1.9.2 : nothing to do! Yay!remote: Bundle completed (54.39s)remote: Cleaning up the bundler cache.remote: -----> Writing config/database.yml to read from DATABASE_URLremote: -----> Preparing app for Rails asset pipelineremote: Running: rake assets:precompileremote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_7f6590528210ec3b45a43e69c0119446/Rakefile:7)remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_7f6590528210ec3b45a43e69c0119446/Rakefile:7)remote: rake aborted!remote: ExecJS::ProgramError: Unexpected token: operator (=) (line: 10770, col: 0, pos: 300859)remote: Errorremote: at new JS_Parse_Error (/tmp/execjs20150523-743-1p3uckwjs:2359:10623)remote: at js_error (/tmp/execjs20150523-743-1p3uckwjs:2359:10842)remote: at croak (/tmp/execjs20150523-743-1p3uckwjs:2359:19086)remote: at token_error (/tmp/execjs20150523-743-1p3uckwjs:2359:19223)remote: at unexpected (/tmp/execjs20150523-743-1p3uckwjs:2359:19311)remote: at expr_atom (/tmp/execjs20150523-743-1p3uckwjs:2359:27526)remote: at maybe_unary (/tmp/execjs20150523-743-1p3uckwjs:2359:30019)remote: at expr_ops (/tmp/execjs20150523-743-1p3uckwjs:2359:30777)remote: at maybe_conditional (/tmp/execjs20150523-743-1p3uckwjs:2359:30869)remote: at maybe_assign (/tmp/execjs20150523-743-1p3uckwjs:2359:31312)remote: at expression (/tmp/execjs20150523-743-1p3uckwjs:2359:31625)remote: at simple_statement (/tmp/execjs20150523-743-1p3uckwjs:2359:22563)remote: at /tmp/execjs20150523-743-1p3uckwjs:2359:20468remote: (in /tmp/build_7f6590528210ec3b45a43e69c0119446/app/assets/javascripts/application.js)new JS_Parse_Error ((execjs):2359:10623)remote: js_error ((execjs):2359:10842)remote: croak ((execjs):2359:19086)remote: token_error ((execjs):2359:19223)remote: unexpected ((execjs):2359:19311)remote: expr_atom ((execjs):2359:27526)remote: maybe_unary ((execjs):2359:30019)remote: expr_ops ((execjs):2359:30777)remote: maybe_conditional ((execjs):2359:30869)remote: maybe_assign ((execjs):2359:31312)remote: expression ((execjs):2359:31625)remote: simple_statement ((execjs):2359:22563)remote: (execjs):2359:20468remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:39:in `exec'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:21:in `eval'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/execjs-2.5.2/lib/execjs/external_runtime.rb:46:in `call'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/uglifier-2.7.1/lib/uglifier.rb:212:in `run_uglifyjs'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/uglifier-2.7.1/lib/uglifier.rb:179:in `compile'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/compressors.rb:74:in `compress'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/processing.rb:265:in `block in js_compressor='remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/processor.rb:29:in `call'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/processor.rb:29:in `evaluate'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/context.rb:193:in `block in evaluate'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/context.rb:190:in `each'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/context.rb:190:in `evaluate'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/bundled_asset.rb:26:in `initialize'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:252:in `new'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:252:in `build_asset'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/static_compiler.rb:19:in `block in compile'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:219:in `block in each_logical_path'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:196:in `each'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:196:in `each_entry'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:204:in `block in each_file'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:203:in `each'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:203:in `each_file'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:217:in `each_logical_path'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/static_compiler.rb:18:in `compile'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:56:in `internal_precompile'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:70:in `block (3 levels) in<top (required)>'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:60:in `block (3 levels) in<top (required)>'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'remote: /tmp/build_7f6590528210ec3b45a43e69c0119446/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.21/lib/sprockets/assets.rake:29:in `block (2 levels) in<top (required)>'remote: Tasks: TOP => assets:precompile:primaryremote: (See full trace by running task with --trace)remote: !remote: ! Precompiling assets failed.remote: !remote:remote: ! Push rejected, failed to compile Ruby appremote:remote: Verifying deploy...remote:remote: ! Push rejected to whispering-chamber-4883.remote:To https://git.heroku.com/whispering-chamber-4883.git ! [remote rejected] master -> master (pre-receive hook declined)error: failed to push some refs to 'https://git.heroku.com/whispering-chamber-4883.git'Thanks. 解决方案 You probably already solved this by now, but I stumbled across this issue and wanted to share my solution.As an answer above suggested, the best way to track the error down to the problematic file is to runrake assets:precompile RAILS_ENV=productionlocally while excluding files or directories you might think contain the problem. I deleted directories one by one (which I could later checkout again from my repo) until I got the precompilation running. I then drilled down into the last deleted directory and tracked it down to a certain file and a function of the form array.find(name => name.id === user_id);My research showed that it turns out the largest update to Javascript (ES5) was released in 2009 and since then, only unitl June 2015 was the ECMAScript 6 (ES6) final specification released. The syntax used in this function is supported by ES6 but not ES5 and ES6 is not yet supported on Rails (I was running RoR 5.0.0.1), at least not with ExecJS on the assets pipeline.What you CAN do, is change your function to an alternative syntax, namelyarray.find(function(name){return name.id === user_id});and it should work equivalently.More on the find function hereTo get ES6 working on RoR, you might want to check out Babel, as described here 这篇关于预编译资产失败ExecJS :: ProgramError:意外的标记:运算符(=)(行:10770,col:0,pos:300859)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-16 00:53