60e7b7377ac3f6923ee0a88a3f51f86d0e60c68d
By:
fulvio

Unicorn error with ruby_dep gem - Rails app

August 4, 2016 869 views
Ruby on Rails Deployment One-Click Install Apps Nginx Ubuntu

I have the following error, saying that couldn't find the gem ruby_dep-1.4.0 but as you see when i listed the gem it's already installed. How can I solve this?

root@RCSO-server:/home/rails/rcso# gem list ruby_dep

*** LOCAL GEMS ***

ruby_dep (1.4.0)
root@RCSO-server:/home/rails/rcso#

/var/log/unicorn

E, [2016-08-04T01:20:20.462512 #7540] ERROR -- : Could not find ruby_dep-1.4.0 in any of the sources (Bundler::GemNotFound)
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/spec_set.rb:92:in `block in materialize'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/spec_set.rb:85:in `map!'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/spec_set.rb:85:in `materialize'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/definition.rb:132:in `specs'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/definition.rb:177:in `specs_for'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/definition.rb:166:in `requested_specs'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/environment.rb:18:in `requested_specs'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/runtime.rb:13:in `setup'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler.rb:122:in `setup'
/usr/local/rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.4/lib/bundler/setup.rb:18:in `<top (required)>'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/rails/rcso/config/boot.rb:3:in `<top (required)>'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/rails/rcso/config/application.rb:1:in `<top (required)>'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/rails/rcso/config/environment.rb:2:in `<top (required)>'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
config.ru:4:in `block in <main>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
/usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn.rb:46:in `eval'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn.rb:46:in `block in builder'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:752:in `call'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:752:in `build_app!'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:617:in `init_worker_process'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:639:in `worker_loop'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:519:in `maintain_worker_count'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:283:in `join'
/usr/local/rvm/gems/ruby-2.2.1/gems/unicorn-5.0.1/bin/unicorn:126:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/bin/unicorn:23:in `load'
/usr/local/rvm/gems/ruby-2.2.1/bin/unicorn:23:in `<main>'
/usr/local/rvm/gems/ruby-2.2.1@global/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.1@global/bin/ruby_executable_hooks:15:in `<main>'
E, [2016-08-04T01:20:20.470920 #7520] ERROR -- : reaped #<Process::Status: pid 7540 exit 1> worker=1
E, [2016-08-04T01:20:20.471107 #7520] ERROR -- : reaped #<Process::Status: pid 7543 exit 1> worker=2
E, [2016-08-04T01:20:20.471199 #7520] ERROR -- : reaped #<Process::Status: pid 7546 exit 1> worker=3
I, [2016-08-04T01:20:20.471361 #7520]  INFO -- : worker=1 spawning...
I, [2016-08-04T01:20:20.471848 #7520]  INFO -- : worker=2 spawning...
I, [2016-08-04T01:20:20.472618 #7552]  INFO -- : worker=0 spawned pid=7552
I, [2016-08-04T01:20:20.476452 #7520]  INFO -- : worker=3 spawning...
I, [2016-08-04T01:20:20.477223 #7554]  INFO -- : worker=1 spawned pid=7554
I, [2016-08-04T01:20:20.480534 #7557]  INFO -- : worker=2 spawned pid=7557
I, [2016-08-04T01:20:20.484604 #7560]  INFO -- : worker=3 spawned pid=7560
I, [2016-08-04T01:20:20.549274 #7554]  INFO -- : Refreshing Gem list
I, [2016-08-04T01:20:20.553290 #7552]  INFO -- : Refreshing Gem list
I, [2016-08-04T01:20:20.556044 #7557]  INFO -- : Refreshing Gem list
I, [2016-08-04T01:20:20.560041 #7560]  INFO -- : Refreshing Gem list
2 Answers
fulvio August 5, 2016
Accepted Answer

The problem was that I had setup the path on the unicorn file wrong, I used rvm to set my ruby env to 2.2.5, and unicorn had the PATH, GEMPATH and GEMHOME pointing to ruby 2.2.1, I just changed the ruby version on /etc/default/unicorn file:

Preview

#PATH=/usr/local/rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-2.2.1@global/bin:/usr/local/rvm/gems/ruby-2.2.1/bin/
#export GEM_HOME=/usr/local/rvm/gems/ruby-2.2.1
#export GEM_PATH=/usr/local/rvm/gems/ruby-2.2.1:/usr/local/rvm/gems/ruby-2.2.1@global
#DAEMON=/usr/local/rvm/gems/ruby-2.2.1/bin/unicorn

After change

PATH=/usr/local/rvm/rubies/ruby-2.2.5/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-2.2.5@global/bin:/usr/local/rvm/gems/ruby-2.2.5/bin/
export GEM_HOME=/usr/local/rvm/gems/ruby-2.2.5
export GEM_PATH=/usr/local/rvm/gems/ruby-2.2.5:/usr/local/rvm/gems/ruby-2.2.5@global
DAEMON=/usr/local/rvm/gems/ruby-2.2.5/bin/unicorn

I'm no Bundler expert, but a guess would be that the gem was installed directly via "gem install" (and thus the Gemfile makes no reference to it) and Unicorn is being run via "bundle exec".

Just a guess :)

Have another answer? Share your knowledge.