Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load such file uglifier

I keep getting this error:

throw Error("LoadError:cannot load such file -- uglifier\n  (in /var/www/dev/app)

I can't handle this error on Rails 4.1.4. This is my Gemfile:

source 'https://rubygems.org'
gem 'rails', '4.1.4'
gem 'mysql2'
gem 'jquery-rails'
gem 'devise'
gem 'spring',        group: :development
gem 'unicorn'

I tried to keep the app as light as possible so I removed turbolinks, and all those initial gems:

 -gem 'sass-rails', '~> 4.0.3'
 -gem 'uglifier', '>= 1.3.0'
 -gem 'coffee-rails', '~> 4.0.0'  
 -gem 'turbolinks'

I used rake assets:precompile or RAILS_ENV=production rake assets:precompile and I keep getting that the JS file wrong compiled.

This is my application.js:

//= require jquery
//= require jquery_ujs
//= require_tree .

And this is my production.rb:

# Compress JavaScripts and CSS. 
# config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
config.assets.precompile =  ['*.js', '*.css', '*.css.erb'] 
like image 500
Sîrbu Nicolae-Cezar Avatar asked Jul 25 '14 00:07

Sîrbu Nicolae-Cezar


1 Answers

I know this is an old question, but in case some people are having this same issue, I decided to answer.


Try removing the uglifier gem from your Gemfile entirely and don't forget to 'bundle install'.

like image 157
Joel Smith Avatar answered Nov 02 '22 21:11

Joel Smith