Ruby on Rails - $ rails server fails because uglifier gem could not be found

10,527

Solution 1

  1. Locate your Gemfile {C:\Users[your name]\Desktop\sample_app}
  2. In line 1, change https to http {source 'http://rubygems.org'}
  3. Save changes in Gemfile
  4. In your Gitbash, type "bundle install" and hit Enter

Solution 2

I was following these instructions: Installing Ruby, Rails and Rubymine in Ubuntu 14.04

and had the same problem when I got to testing the rails server. while creating the new demo:

abc@ubuntu:~/rails_demo$ rails new demo

An error occurred while installing uglifier (2.5.3), and Bundler cannot continue.Make sure that gem install uglifier -v '2.5.3' succeeds before bundling. run bundle exec spring binstub --al

I did not catch the above until I attempted to run the server

abc@ubuntu:~/rails_demo/demo$ rails server
Could not find gem 'uglifier (>= 1.3.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
abc@ubuntu:~/rails_demo/demo$ bundle install uglifier
ERROR: "bundle install" was called with arguments ["uglifier"]
Usage: "bundle install [OPTIONS]"

running the following fixed the problem:

gem install uglifier -v '2.5.3'

bundle exec spring binstub --all

hope it helps

Solution 3

Check if your Gemfile has the following gem

gem 'uglifier'

If the Gem is not present add it to your Gemfile. Sometimes it turns out that your Gemfile.lock has the dependency but you might have commented the Gem in Gemfile.

I you already have the gem in Gemfile run bundle install and check if the bundler is installing the uglifier gem

Share:
10,527

Related videos on Youtube

Shwheelz
Author by

Shwheelz

Updated on September 15, 2022

Comments

  • Shwheelz
    Shwheelz over 1 year

    I'm starting my first project on Ruby and the tutorial I'm following has me using rails. When I try to run $ rails server I get an error that says: Could not find gem uglifier (>=1.3.0) x86-mingw32 in the gems available on this machine.

    I had this error with a few other gems, and I was able to fix it by simply doing the gem install of the gem at hand, but this one is giving me errors. These errors started to appear after I tried to install the dev kit for the first time. When I try $ gem install uglifier I get a large mess of errors that can be seen here.

    I am running on a Windows 8 tablet. While I realize Ubuntu is the preference for this situation, I'm trying to make the best with what I'm given. Any help would be greatly appreciated.

  • Robert Longson
    Robert Longson about 8 years
    The OP is on windows.
  • Richard Octovianus
    Richard Octovianus almost 7 years
    unfortunately op is on windows, for ubuntu it's working.