I use rbenv and bundler for my ruby application environment.
My 'bundle show':
bundle show
Gems included by the bundle:
* activemodel (3.2.13)
* activerecord (3.2.13)
* activesupport (3.2.13)
* addressable (2.3.4)
* arel (3.0.2)
* bcrypt-ruby (3.0.1)
* builder (3.0.4)
* bundler (1.16.2)
* erubis (2.7.0)
* eventmachine (1.0.3)
* faraday (0.8.7)
* haml (4.0.2)
* haml-contrib (1.0.0)
* hashie (1.2.0)
* hipchat (1.0.1)
* hiredis (0.4.5)
* httparty (0.11.0)
* i18n (0.6.1)
* json (1.7.7)
* kgio (2.8.0)
* maruku (0.6.1)
* multi_json (1.9.0)
* multi_xml (0.5.5)
* multipart-post (1.2.0)
* oa-core (0.3.2)
* oa-openid (0.3.2)
* omniauth (1.0.3)
* omniauth-google-apps (0.0.2)
* omniauth-openid (1.0.1)
* pg (0.15.1)
* rack (1.6.0.alpha 838865f)
* rack-contrib (1.2.0 6f33726)
* rack-flash3 (1.0.3 1f60bb2)
* rack-openid (1.3.1)
* rack-protection (1.5.0)
* raindrops (0.11.0)
* rake (10.0.4)
* redis (3.0.4)
* redis-objects (0.7.0)
* ruby-openid (2.2.3)
* ruby-openid-apps-discovery (1.2.0)
* sass (3.2.9)
* sinatra (1.4.2)
* sinatra-activerecord (1.2.2)
* sinatra-static-assets (1.0.4)
* sqlite3 (1.3.7)
* syntax (1.0.0)
* tilt (1.4.1)
* tzinfo (0.3.37)
* unicorn (4.6.2)
* uuidtools (2.1.4)
* will_paginate (3.0.4)
* yajl-ruby (1.1.0)
My 'gem env' show:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems
- RUBY EXECUTABLE: /home/myapp/.rbenv/versions/1.9.3-p484/bin/ruby
- EXECUTABLE DIRECTORY: /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
My global and local ruby version is the same:
rbenv version
1.9.3-p484
Now when i start my app with command:
bundle exec unicorn -c my_unicorn_config.rb -d
I get this in my error log:
I, [2018-05-30T20:03:27.278911 #29102] INFO -- : listening on addr=0.0.0.0:19001 fd=7
I, [2018-05-30T20:03:27.280553 #29102] INFO -- : master process ready
I, [2018-05-30T20:03:27.280701 #29104] INFO -- : Refreshing Gem list
I, [2018-05-30T20:03:27.281393 #29107] INFO -- : Refreshing Gem list
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:81 - cannot load such file -- haml-contrib
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:95 - cannot load such file -- haml/contrib
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:81 - cannot load such file -- haml-contrib
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:95 - cannot load such file -- haml/contrib
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:81 - cannot load such file -- sinatra-activerecord
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:81 - cannot load such file -- sinatra-activerecord
Exception `NameError' at /home/myapp/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/psych/core_ext.rb:16 - method `to_yaml' not defined in Object
Exception `NameError' at /home/myapp/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/psych/core_ext.rb:16 - method `to_yaml' not defined in Object
Exception `NameError' at /home/myapp/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/psych/core_ext.rb:29 - method `yaml_as' not defined in Module
Exception `NameError' at /home/myapp/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/psych/core_ext.rb:29 - method `yaml_as' not defined in Module
Exception `NameError' at /home/myapp/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/psych/deprecated.rb:79 - undefined method `to_yaml_properties' for class `Object'
Exception `NameError' at /home/myapp/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/psych/deprecated.rb:79 - undefined method `to_yaml_properties' for class `Object'
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:81 - cannot load such file -- activerecord
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler-1.16.2/lib/bundler/runtime.rb:81 - cannot load such file -- activerecord
Exception `LoadError' at /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:4 - cannot load such file -- sqlite3/1.9/sqlite3_native
Why bundler/runtime.rb can't load my gems?
I also define my gem env vars with export GEM_HOME="${HOME}/myapp/shared/bundle/ruby/1.9.1/gems"
as well as export GEM_PATH="${GEM_HOME}"
EDIT:
My bundle check output does show that all deps are satisfied:
[myapp@myapp appuser]$ bundle check
Your Gemfile lists the gem uuidtools (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of one of them later.
The Gemfile's dependencies are satisfied
sqlite3
gem only the Ruby interface to SQLite3 but not SQLite3 itself? – spickermann