1

I am trying to deploy my rails application to a digitalocean VPS droplet. I have the following setup Ruby on Rails on Ubuntu 12.10 (Nginx + Unicorn). I have installed Ruby ruby-2.0.0-p247 and rails Rails 4.0.0 via rvm but when I try to restart Unicorn I get the following error.

/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/
  core_ext/kernel_require.rb:45:in 
    `require': cannot load such file -- unicorn/launcher (LoadError)

from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/
  core_ext/kernel_require.rb:45:in 
    `require' from /usr/bin/unicorn:3:in `<main>'

Could it be because if my GEM_HOME and GEM_PATH are different?

$GEM_PATH:
/usr/local/rvm/gems/ruby-2.0.0-p247:/usr/local/rvm/gems/ruby-2.0.0-p247@global

$GEM_HOME:
/usr/local/rvm/gems/ruby-2.0.0-p247
Casper
  • 33,403
  • 4
  • 84
  • 79
jdeleon
  • 63
  • 2
  • 7
  • No, GEM_HOME only tells `gem install` where to put new gems. GEM_PATH tells Rubygems where to find gems. So next question becomes: did you install unicorn somewhere in your GEM_PATH? – Casper Oct 16 '13 at 01:48
  • Yep looks like unicorn-4.6.3 is in the /usr/local/rvm/gems/ruby-2.0.0-p247/gems folder – jdeleon Oct 16 '13 at 02:12
  • Your `PATH` is not set up properly. You're running the unicorn binary from `/usr/bin` (see error message). You should be running it from the rvm bin directory. Make sure rvm is set up correctly (you are running the rvm init scripts), and that `PATH` contains the rvm bin directory before anything else. – Casper Oct 16 '13 at 02:51
  • http://stackoverflow.com/a/19189111/823617 – Casper Oct 16 '13 at 02:52
  • @Casper that was it! thank you so much! please place the answer below so you get the cred. – jdeleon Oct 16 '13 at 03:17

1 Answers1

0

Your PATH is not set up properly. You're running the unicorn binary from /usr/bin (see error message). You should be running it from the rvm bin directory. Make sure rvm is set up correctly (you are running the rvm init scripts), and that PATH contains the rvm bin directory before anything else.

See here for some further discussion on rvm and PATH for a similar issue:
https://stackoverflow.com/a/19189111/823617

Community
  • 1
  • 1
Casper
  • 33,403
  • 4
  • 84
  • 79