My minimal app runs locally and I have no bundle errors. When I push to heroku, however, the build fails during assets:precompile step:
...
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)
Notes:
1. I am not using the uglifier gem locally
2. I do not have a file app/assets/javascripts/application.js
I have tried these Gemfile solutions:
A) adding the uglifier gem
B) adding uglifier to the assets group
C) removing uglifier completely from Gemfile and rake uninstall all versions
What's next?
Comment this line in config/environments/production.rb
config.assets.js_compressor = :uglifier
A better solution, if you want to compress your assets, is to add uglifier
to your GEMFILE:
gem 'uglifier'
If you're interested in continuing to use uglifier
, you can add it to your Gemfile
(and install with Bundler) -- as explained by @mindtonic.
Also, if you're using ES6, you'll need to switch:
config.assets.js_compressor = :uglifier
to:
config.assets.js_compressor = Uglifier.new(harmony: true)
As explained in https://github.com/lautis/uglifier/issues/127
You have to focus on two points:
Point 1. Version of the Gem: This should be 4.2
gem 'uglifier', '~> 4.2'
Point 2. Use js compressor now
config.assets.js_compressor = Uglifier.new(harmony: true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With