0

I'm trying to run this example:

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

But I'm getting this error when trying to run unicorn:

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

When I run bundle install I have no problems and this is the output of 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)

It seems that everything is alright. Any ideas? Thanks for the help.

UPDATE:

I have run bundle update on the project, this is the new 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
Ruenzuo
  • 716
  • 6
  • 23

1 Answers1

0

Those are very old versions of gems, Sinatra is at 1.4.1 at the time of writing this, and Rack is around 1.5 from memory. I'd suggest sandboxing your gems too, either using RVM's gemsets, or you can run bundle install --binstubs --path vendor to keep all the gems within the project dir, and then use either bundle exec… or bin/rackup… (or whatever) to run things.

Look at the Gemfile or post it up for us to see, and remove some of the version constraints on the major libraries and see if that helps.

iain
  • 11,098
  • 9
  • 43
  • 93
  • I have run bundle update on the project and I posted the new gemfile.lock, but it didn't solve my issue. – Ruenzuo Oct 27 '13 at 06:22
  • 1
    lets try replacing `require 'app'` with `require './app'` in your config.ru file – CoderPug Oct 27 '13 at 10:19
  • 1
    @Ruenzuo you're using `gem` commands when you need to use `bundle` commands. Post the output of `bundle list` and trying running the rackup file via `bin/rackup config.ru` and see what happens. – iain Oct 27 '13 at 12:54
  • @iain running `bin/rackup config.ru` displayed a detail description of the error which led me to this: http://stackoverflow.com/questions/9368561/ruby-datamapper-will-not-load now I solved it, thanks! – Ruenzuo Oct 27 '13 at 22:14
  • 1
    @Ruenzuo glad to hear it! When you use `--binstubs --path vendor` it sandboxes the environment, so either prepend `bin/xxx` or `bundle exec` (which I also alias to `be`) to your commands and it'll only use the gems installed by bundler. I find it cuts out a lot of problems and confusion. – iain Oct 28 '13 at 07:13