【发布时间】:2018-11-10 12:31:26
【问题描述】:
我将 rbenv 和 bundler 用于我的 ruby 应用程序环境。
我的“捆绑秀”:
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)
我的“宝石环境”秀:
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/
我的全局和本地 ruby 版本是一样的:
rbenv version
1.9.3-p484
现在当我使用命令启动我的应用程序时:
bundle exec unicorn -c my_unicorn_config.rb -d
我在我的错误日志中得到了这个:
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
为什么 bundler/runtime.rb 无法加载我的 gem?
我还用export GEM_HOME="${HOME}/myapp/shared/bundle/ruby/1.9.1/gems" 定义了我的gem env vars
还有export GEM_PATH="${GEM_HOME}"
编辑:
我的包检查输出确实显示所有部门都满意:
[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
【问题讨论】:
-
以防万一想使用与独角兽配合良好的主管:immortal.run/post/run.yml
-
我的错误不在 'require' 中,请参阅 /home/myapp/myapp/shared/bundle/ruby/1.9.1/gems/gems/bundler 中的日志“Exception `LoadError' -1.16.2/lib/bundler/runtime.rb:81 - 无法加载此类文件 -- haml-contrib"
-
SQLite3 本身是否安装在您的机器上?提示:
sqlite3gem 只是 SQLite3 的 Ruby 接口,而不是 SQLite3 本身? -
能发一下独角兽的配置吗?
标签: ruby bundler unicorn rbenv