Ruby on rails Heroku构建在丑八怪上失败

Ruby on rails Heroku构建在丑八怪上失败,ruby-on-rails,heroku,gemfile,Ruby On Rails,Heroku,Gemfile,我的最小应用程序在本地运行,我没有捆绑包错误。但是,当我推到heroku时,构建在assets:precompile步骤中失败: ... Bundle completed (3.24s) Cleaning up the bundler cache. -----> Preparing app for Rails asset pipeline Running: rake assets:precompole rake aborted! LoadError: cannot load such fi

我的最小应用程序在本地运行,我没有捆绑包错误。但是,当我推到heroku时,构建在assets:precompile步骤中失败:

...
Bundle completed (3.24s)
Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompole
rake aborted!
LoadError: cannot load such file -- uglifier
(in /tmp/build_.../app/assets/javascripts/application.js)
备注:
1.我没有在本地使用丑陋的宝石
2.我没有app/assets/javascripts/application.js文件

我已经尝试过这些解决方案:
A)添加丑陋的宝石
B)将丑八怪添加到资产组
C)从Gemfile中完全删除uglifier并卸载所有版本


下一步是什么?

在config/environments/production.rb中评论这一行

config.assets.js_compressor = :uglifier

如果您想压缩资产,更好的解决方案是将
uglifier
添加到您的文件中:


gem'uglifier'

如果您有兴趣继续使用
uglifier
,您可以将其添加到
Gemfile
(并使用Bundler安装)--如@mindtonic所述

此外,如果您正在使用ES6,则需要切换:

config.assets.js_compressor = :uglifier
致:


中所述,您必须关注两点:

第1点。创业板版本:应该是4.2

gem 'uglifier', '~> 4.2'
第2点。立即使用js压缩机

config.assets.js_compressor = Uglifier.new(harmony: true)

您根本不想使用资产管道?请检查浏览器控制台上是否存在javascript错误。试着在本地机器上进行预编译。除了pg_ext之外,预编译在本地工作,这似乎是一个与uglifier不同的问题。我不明白的是,既然我从Gemfile中删除了uglifier并卸载了所有版本,为什么会引用它?别忘了在下一次推送之前提交!:-)
config.assets.js_compressor = Uglifier.new(harmony: true)