【发布时间】:2019-06-22 12:54:56
【问题描述】:
在 heroku 上部署我的 Rails 应用程序时出现以下错误,
远程:捆绑完成(163.81 秒) 远程:清理捆绑器缓存。 远程:-----> 安装 node-v8.10.0-linux-x64 远程: -----> 检测 rake 任务 远程:-----> 为 Rails 资产管道准备应用程序 远程:运行:耙资产:预编译 远程:系统中未检测到纱线可执行文件。 远程:在 https://yarnpkg.com/en/docs/install 下载 Yarn 远程:rake 中止! 远程:Uglifier::Error:意外的标记 punc «;»,预期的 punc «,» 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/uglifier-4.1.20/lib/uglifier.rb:234:in `parse_result' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/uglifier-4.1.20/lib/uglifier.rb:216:in `run_uglifyjs' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/uglifier-4.1.20/lib/uglifier.rb:168:in `compile' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/compressing.rb:65:in `block in js_compressor=' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/legacy_proc_processor.rb:31:in `call' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `blockin load' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define' 远程:/tmp/build_eb48b48285b82dae89f9dfd764c51c22/vendor/bundle/ruby/2.4.0/gems/rake-12.3.2/exe/rake:27:in `' 远程:任务:TOP => 资产:预编译 远程:(通过使用 --trace 运行任务查看完整跟踪) 偏僻的: 偏僻的: ! 偏僻的: !预编译资产失败。 偏僻的: ! 偏僻的: ! Push 被拒绝,无法编译 Ruby 应用程序。 偏僻的: 偏僻的: !推送失败 远程:验证部署...我已经将production.rb中的行修改为,
config.assets.js_compressor = Uglifier.new(harmony: true)
但错误仍然存在。
【问题讨论】:
-
该命令的返回是:Uglifier::Error: Unexpected token eof «undefined», expected punc «,»。要使用 ES6 语法,必须使用 Uglifier.new(:harmony => true) 启用和声模式。来自 (irb):18:in
block in irb_binding' from (irb):16:ineach' 来自 (irb):16
标签: ruby-on-rails heroku