0

我正在尝试运行此示例:

https://github.com/bbcrd/REST-API-example

但是在尝试运行独角兽时出现此错误:

Renzos-MacBook-Pro:REST-API-example ruenzuo$ unicorn -p 7000
I, [2013-10-22T18:57:24.939197 #763]  INFO -- : listening on addr=0.0.0.0:7000 fd=3
I, [2013-10-22T18:57:24.940242 #763]  INFO -- : worker=0 spawning...
I, [2013-10-22T18:57:24.941458 #763]  INFO -- : master process ready
I, [2013-10-22T18:57:24.942852 #765]  INFO -- : worker=0 spawned pid=765
I, [2013-10-22T18:57:24.943437 #765]  INFO -- : Refreshing Gem list
/Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': no such file to load -- app (LoadError)
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from config.ru:1:in `block in <main>'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn.rb:30:in `eval'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn.rb:30:in `block in builder'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:696:in `call'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:696:in `build_app!'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:563:in `init_worker_process'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:578:in `worker_loop'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:495:in `block (2 levels) in spawn_missing_workers'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:492:in `fork'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:492:in `block in spawn_missing_workers'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:488:in `each'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:488:in `spawn_missing_workers'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:502:in `maintain_worker_count'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn/http_server.rb:161:in `start'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/lib/unicorn.rb:13:in `run'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/unicorn-3.4.0/bin/unicorn:120:in `<top (required)>'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/bin/unicorn:23:in `load'
    from /Users/ruenzuo/.rvm/rubies/ruby-1.9.2-p320/bin/unicorn:23:in `<main>'
    from /Users/ruenzuo/.rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in `eval'
    from /Users/ruenzuo/.rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in `<main>'
E, [2013-10-22T18:57:25.040304 #763] ERROR -- : reaped #<Process::Status: pid 765 exit 1> worker=0

当我运行 bundle install 时,我没有问题,这是 gem query --local 的输出:

*** LOCAL GEMS ***

addressable (2.2.4)
bundler (1.3.5)
bundler-unload (1.0.2)
data_objects (0.10.3)
datamapper (1.0.2)
dm-aggregates (1.0.2)
dm-constraints (1.0.2)
dm-core (1.0.2)
dm-do-adapter (1.0.2)
dm-is-state_machine (1.0.2)
dm-migrations (1.0.2)
dm-mysql-adapter (1.0.2)
dm-redis-adapter (0.2.3)
dm-serializer (1.0.2)
dm-sqlite-adapter (1.0.2)
dm-timestamps (1.0.2)
dm-transactions (1.0.2)
dm-types (1.0.2)
dm-validations (1.0.2)
do_mysql (0.10.3)
do_sqlite3 (0.10.3)
executable-hooks (1.2.5)
extlib (0.9.15)
fastercsv (1.5.4)
json (1.5.1)
json_pure (1.5.1)
kgio (2.3.2)
minitest (1.6.0)
mysql2 (0.3.13)
rack (1.2.1)
rack-cache (1.0)
rack-contrib (1.1.0)
rake (0.8.7)
rdoc (2.5.8)
redis (2.1.1)
rubygems-bundler (1.4.0)
rvm (1.11.3.8)
sinatra (1.1.3)
stringex (1.1.0)
systemu (1.2.0)
tilt (1.2.2)
unicorn (3.4.0)
uuidtools (2.1.2)

似乎一切都很好。有任何想法吗?谢谢您的帮助。

更新:

我已经在项目上运行包更新,这是新的 gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    addressable (2.3.5)
    bcrypt-ruby (3.1.2)
    builder (3.2.2)
    data_objects (0.10.13)
      addressable (~> 2.1)
    datamapper (1.2.0)
      dm-aggregates (~> 1.2.0)
      dm-constraints (~> 1.2.0)
      dm-core (~> 1.2.0)
      dm-migrations (~> 1.2.0)
      dm-serializer (~> 1.2.0)
      dm-timestamps (~> 1.2.0)
      dm-transactions (~> 1.2.0)
      dm-types (~> 1.2.0)
      dm-validations (~> 1.2.0)
    dm-aggregates (1.2.0)
      dm-core (~> 1.2.0)
    dm-constraints (1.2.0)
      dm-core (~> 1.2.0)
    dm-core (1.2.1)
      addressable (~> 2.3)
    dm-do-adapter (1.2.0)
      data_objects (~> 0.10.6)
      dm-core (~> 1.2.0)
    dm-is-state_machine (1.2.0)
      dm-core (~> 1.2.0)
    dm-migrations (1.2.0)
      dm-core (~> 1.2.0)
    dm-mysql-adapter (1.2.0)
      dm-do-adapter (~> 1.2.0)
      do_mysql (~> 0.10.6)
    dm-redis-adapter (0.8.4)
      dm-core (>= 1.2.0)
      dm-types (>= 1.2.0)
      dm-validations (>= 1.2.0)
      hiredis (~> 0.4.0)
      jeweler (>= 1.4.0)
      rake (>= 10.0.3)
      redis (>= 3.0.4)
      rspec (~> 1.3.2)
    dm-serializer (1.2.2)
      dm-core (~> 1.2.0)
      fastercsv (~> 1.5)
      json (~> 1.6)
      json_pure (~> 1.6)
      multi_json (~> 1.0)
    dm-sqlite-adapter (1.2.0)
      dm-do-adapter (~> 1.2.0)
      do_sqlite3 (~> 0.10.6)
    dm-timestamps (1.2.0)
      dm-core (~> 1.2.0)
    dm-transactions (1.2.0)
      dm-core (~> 1.2.0)
    dm-types (1.2.2)
      bcrypt-ruby (~> 3.0)
      dm-core (~> 1.2.0)
      fastercsv (~> 1.5)
      json (~> 1.6)
      multi_json (~> 1.0)
      stringex (~> 1.4)
      uuidtools (~> 2.1)
    dm-validations (1.2.0)
      dm-core (~> 1.2.0)
    do_mysql (0.10.13)
      data_objects (= 0.10.13)
    do_sqlite3 (0.10.13)
      data_objects (= 0.10.13)
    extlib (0.9.16)
    faraday (0.8.8)
      multipart-post (~> 1.2.0)
    fastercsv (1.5.5)
    git (1.2.6)
    github_api (0.10.1)
      addressable
      faraday (~> 0.8.1)
      hashie (>= 1.2)
      multi_json (~> 1.4)
      nokogiri (~> 1.5.2)
      oauth2
    hashie (2.0.5)
    highline (1.6.20)
    hiredis (0.4.5)
    httpauth (0.2.0)
    jeweler (1.8.8)
      builder
      bundler (~> 1.0)
      git (>= 1.2.5)
      github_api (= 0.10.1)
      highline (>= 1.6.15)
      nokogiri (= 1.5.10)
      rake
      rdoc
    json (1.8.1)
    json_pure (1.8.1)
    jwt (0.1.8)
      multi_json (>= 1.5)
    kgio (2.8.1)
    multi_json (1.8.2)
    multi_xml (0.5.5)
    multipart-post (1.2.0)
    nokogiri (1.5.10)
    oauth2 (0.9.2)
      faraday (~> 0.8)
      httpauth (~> 0.2)
      jwt (~> 0.1.4)
      multi_json (~> 1.0)
      multi_xml (~> 0.5)
      rack (~> 1.2)
    rack (1.5.2)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-protection (1.5.1)
      rack
    raindrops (0.12.0)
    rake (10.1.0)
    rdoc (4.0.1)
      json (~> 1.4)
    redis (3.0.5)
    rspec (1.3.2)
    sinatra (1.4.4)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    stringex (1.5.1)
    systemu (2.5.2)
    tilt (1.4.1)
    unicorn (4.6.3)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    uuidtools (2.1.4)

PLATFORMS
  ruby

DEPENDENCIES
  data_objects
  datamapper
  dm-aggregates
  dm-constraints
  dm-core
  dm-is-state_machine
  dm-migrations
  dm-mysql-adapter
  dm-redis-adapter
  dm-serializer
  dm-sqlite-adapter
  dm-timestamps
  dm-types
  dm-validations
  do_mysql
  do_sqlite3
  extlib
  json
  rack-cache
  rack-contrib
  sinatra
  systemu
  unicorn
4

1 回答 1

0

这些是非常旧的 gems 版本,在撰写本文时,Sinatra 的版本为 1.4.1,而 Rack 的内存版本约为 1.5。我建议也对你的 gem 进行沙箱化,或者使用 RVM 的 gemsets,或者你可以运行bundle install --binstubs --path vendor以将所有 gem 保存在项目目录中,然后使用bundle exec……或bin/rackup……(或其他)来运行。

查看 Gemfile 或将其发布以供我们查看,并删除主要库上的一些版本限制,看看是否有帮助。

于 2013-10-23T15:10:34.883 回答