Rails one-click droplet unicorn is failing to find a gem; I can't tell if the right version of the gem is installed.

May 31, 2017 196 views
Ruby on Rails Ubuntu 16.04

My production app has been running for a while. Then yesterday I did a git pull that changed four files and my site stopped loading.

The culprit appears to be unicorn failing to run properly.

No matter what I do, unicorn endlessly crashes and respawns with the following error:

I, [2017-05-31T15:01:10.470158 #3601]  INFO -- : worker=0 spawning...
I, [2017-05-31T15:01:10.471573 #13738]  INFO -- : worker=0 spawned pid=13738
I, [2017-05-31T15:01:10.471847 #13738]  INFO -- : Refreshing Gem list
E, [2017-05-31T15:01:10.499302 #13738] ERROR -- : Could not find i18n-0.8.4 in any of the sources (Bundler::GemNotFound)
/usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/spec_set.rb:87:in `block in materialize'
...

Yet running bundle install shows that i18n-0.8.4 is present in my installed gems list.

I've run down the rabbit hole trying to un/reinstall the gem. It always reports success with the correct version number.

But If I physically list the gems in my gem path, the directory is titled i18n-0.8.1.

After a successful uninstall, directory remains in place with the wrong version number. Same with after a reinstall reporting the correct number is installed.

In my attempts to flush the gemset with rvm, I've managed to break my rails user permissions to gem/bundle install install so that I now have to sudo to get them to run without permissions errors.

And still unicorn can't find the right gem so my site refuses to load.

Can anyone help?

2 Answers

@jcspampinato

Try listing your gems:

gem query --local

or

ruby -e 'puts Gem::Specification.all_names'
  • Thanks for the reply!

    I did this, and the i18n gem is not in the list. Both commands give the same output; a drastically smaller list of gems than the bundle install output.

    I'm uncertain what this means or how to proceed.

    'Local' implies that I have the gem source code locally and I need to download and install the i18n gem onsite now? Despite it being installed successfully without the --local flag? Despite not needing this before my last git pull?

    gem install --local i18n gives me:
    ERROR: Could not find a valid gem 'i18n' (>= 0) in any repository

    gem install i18n yields:
    Fetching: i18n-0.8.4.gem (100%)
    Successfully installed i18n-0.8.4
    1 gem installed

Have another answer? Share your knowledge.