Rails 3 b2+nginx report error "no such file to load -- rack"

Thank you for all your help!!!

<rails 3 beta2+nginx report error “no such file to load – rack”>

I already used google to search this question when I send this message.

but I did not find method of solution.

==================================

     System: Snow leopard 10.6.2

RVM->Ruby: ruby 1.9.2dev (2010-04-04 trunk 27215) [i386-darwin10.0.0]
gem: 1.3.6
Rails: Rails 3.0.0.beta2
database: PostgreSQL 8.4.3

==================================

and set database.yml and nginx.conf

database.yml
development:
adapter: postgresql
encoding: unicode
database: horn_development
pool: 5
username: shajun
password: admin123

==================================

nginx.conf
passenger_root
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11;
passenger_ruby /Users/shajun/.rvm/rubies/ruby-1.9.2-head/bin/ruby;

server {
listen 3001;
server_name horn.local;
root /Users/shajun/project/horn/public; # <— be sure to
point to ‘public’!
passenger_enabled on;
rack_env development;
}

==================================

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0.beta2)
actionpack (3.0.0.beta2)
activemodel (3.0.0.beta2)
activerecord (3.0.0.beta2)
activeresource (3.0.0.beta2)
activesupport (3.0.0.beta2, 2.3.5)
arel (0.3.3)
builder (2.1.2)
bundler (0.9.14)
erubis (2.6.5)
fastthread (1.0.7)
i18n (0.3.6)
mail (2.1.5.3)
memcache-client (1.8.1)
mime-types (1.16)
passenger (2.2.11)
pg (0.9.0)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.1)
rack-test (0.5.3)
rails (3.0.0.beta2)
railties (3.0.0.beta2)
rake (0.8.7)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.4)
treetop (1.4.5)
tzinfo (0.3.18)

==================================

Error: (when input loclhost:3001 in borwser)

Ruby (Rack) application could not be started

A source file that the application requires, is missing.
It is possible that you didn’t upload your application files correctly.
Please check whether all your application files are uploaded.
A required library may not installed. Please install all libraries that
this application requires.
Further information about the error may have been written to the
application’s log file. Please check it in order to analyse the problem.
Error message:
no such file to load – rack
Exception class:
LoadError
Application root:
/Users/shajun/project/horn
Backtrace:

File Line Location

0
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb
143 in require' 1 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb 143 in load_rack_app’
2
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb
104 in block in run' 3 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/utils.rb 255 in report_app_init_status’
4
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb
87 in run' 5 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb 65 in block in spawn_application’
6
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/utils.rb
184 in safe_fork' 7 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb 58 in spawn_application’
8
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/rack/application_spawner.rb
41 in spawn_application' 9 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb 159 in spawn_application’
10
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb
287 in handle_spawn_application' 11 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb 352 in main_loop’
12
/Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb
196 in start_synchronously' 13 /Users/shajun/.rvm/gems/ruby-1.9.2-head/gems/passenger-2.2.11/bin/passenger-spawn-server 61 in

==================================

but when I run “rails server” in application

sha-juns-Mac-Pro:horn shajun$ rails server
=> Booting WEBrick
=> Rails 3.0.0.beta2 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-04-04 23:09:20] INFO WEBrick 1.3.1
[2010-04-04 23:09:20] INFO ruby 1.9.2 (2010-04-04) [i386-darwin10.0.0]
[2010-04-04 23:09:20] INFO WEBrick::HTTPServer#start: pid=1044
port=3000

I would really appreciate your help !!!

jun sha

Hi, did you add the rack gem to your gem file?

-Conrad

Sent from my iPhone

Conrad T. wrote:

Hi, did you add the rack gem to your gem file?

-Conrad

Sent from my iPhone

: - ) Thans! Conrad

I checked my app gem file :

================================================

sha-juns-Mac-Pro:gems shajun$ ls -la
total 0
drwxr-xr-x 32 shajun staff 1088 Apr 4 21:17 .
drwxr-xr-x 7 shajun staff 238 Apr 4 21:10 …
drwxr-xr-x 8 shajun staff 272 Apr 4 21:10 abstract-1.0.0
drwxr-xr-x 6 shajun staff 204 Apr 4 21:14 actionmailer-3.0.0.beta2
drwxr-xr-x 6 shajun staff 204 Apr 4 21:14 actionpack-3.0.0.beta2
drwxr-xr-x 6 shajun staff 204 Apr 4 21:14 activemodel-3.0.0.beta2
drwxr-xr-x 6 shajun staff 204 Apr 4 21:14 activerecord-3.0.0.beta2
drwxr-xr-x 6 shajun staff 204 Apr 4 21:14
activeresource-3.0.0.beta2
drwxr-xr-x 5 shajun staff 170 Apr 4 21:10 activesupport-2.3.5
drwxr-xr-x 5 shajun staff 170 Apr 4 21:13
activesupport-3.0.0.beta2
drwxr-xr-x 6 shajun staff 204 Apr 4 21:13 arel-0.3.3
drwxr-xr-x 9 shajun staff 306 Apr 4 21:10 builder-2.1.2
drwxr-xr-x 8 shajun staff 272 Apr 4 21:10 bundler-0.9.14
drwxr-xr-x 14 shajun staff 476 Apr 4 21:10 erubis-2.6.5
drwxr-xr-x 11 shajun staff 374 Apr 4 21:17 fastthread-1.0.7
drwxr-xr-x 8 shajun staff 272 Apr 4 21:10 i18n-0.3.6
drwxr-xr-x 7 shajun staff 238 Apr 4 21:10 mail-2.1.5.3
drwxr-xr-x 11 shajun staff 374 Apr 4 21:10 memcache-client-1.8.1
drwxr-xr-x 12 shajun staff 408 Apr 4 21:10 mime-types-1.16
drwxr-xr-x 18 shajun staff 612 Apr 4 21:22 passenger-2.2.11
drwxr-xr-x 18 shajun staff 612 Apr 4 21:16 pg-0.9.0
drwxr-xr-x 9 shajun staff 306 Apr 4 21:10 polyglot-0.3.1
drwxr-xr-x 13 shajun staff 442 Apr 4 21:10 rack-1.1.0
drwxr-xr-x 5 shajun staff 170 Apr 4 21:10 rack-mount-0.6.1
drwxr-xr-x 12 shajun staff 408 Apr 4 21:10 rack-test-0.5.3
drwxr-xr-x 3 shajun staff 102 Apr 4 21:14 rails-3.0.0.beta2
drwxr-xr-x 7 shajun staff 238 Apr 4 21:14 railties-3.0.0.beta2
drwxr-xr-x 12 shajun staff 408 Apr 4 21:10 text-format-1.0.0
drwxr-xr-x 10 shajun staff 340 Apr 4 21:10 text-hyphen-1.0.0
drwxr-xr-x 9 shajun staff 306 Apr 4 21:10 thor-0.13.4
drwxr-xr-x 9 shajun staff 306 Apr 4 21:10 treetop-1.4.5
drwxr-xr-x 8 shajun staff 272 Apr 4 21:10 tzinfo-0.3.18

================================================

drwxr-xr-x 13 shajun staff 442 Apr 4 21:10 rack-1.1.0
drwxr-xr-x 5 shajun staff 170 Apr 4 21:10 rack-mount-0.6.1
drwxr-xr-x 12 shajun staff 408 Apr 4 21:10 rack-test-0.5.3

================================================

I read the release message → “Rails 3.0: Second beta release” → from

Note that Ruby 1.8.7 p248 and p249 has marshaling bugs that crash both
Rails 2.3.x and Rails 3.0.0. Ruby 1.9.1 outright segfaults on Rails
3.0.0, so if you want to use Rails 3 with 1.9.x, jump on 1.9.2 trunk for
smooth sailing.

================================================

and, someone suggested that I delete config.ru or change nginx.conf as
below :

  • rails_env development; → rack_env development;

server {
listen 3001;
server_name horn.local;
root /Users/shajun/project/horn/public; # <— be sure to
point to ‘public’!
passenger_enabled on;

    "rails_env development; -> rack_env development;"

 }

but I could not decide this question.

================================================

Thank you very much again! Conrad

from Jun Sha

Jun Sha wrote:

Hi, Conrad

I find method of solution about “no such file to load – rack”

http://rvm.beginrescueend.com/integration/passenger/

=========================================

in /opt/nginx/conf/nginx.conf

passenger_ruby /home/wayne/.rvm/bin/passenger_ruby;

instead of

you current ruby version as “ruby 1.9.2-head…”

=========================================

and then when I input localhost:3002 in browser and click link - > About
your application’s environment

all right !

Ruby version 1.8.7 (i686-darwin10.0.0)

I’m having this same issue, but on Apache with Rails 3 Beta 3. I noticed
that your Ruby version is now 1.8.7 and not 1.9.2. I’m trying to figure
out how to get past the “no such file to load – rack” issue while
keeping Ruby 1.9.2.

I tried your approach of changing passenger_ruby to the home directory
instead of using the “ruby 1.9.2-head” directory but my home directory
is empty. I installed RVM via git so the closest matching folder I can
find is in /root/.rvm/src/rvm/bin/ but I don’t have a passenger_ruby
file in there.

I’ve tried everything I’ve found on Google as possible solutions and
can’t get it to work.

Any advice?
Thanks
Bobby

nevermind, got it working. Once I fully understood all of these
directions: http://rvm.beginrescueend.com/integration/passenger/ I got
it working. Needed to make sure that PassengerRuby was pointed to
something like: /home/wayne/.rvm/bin/passenger_ruby instead of the RVM
ruby

Conrad T. wrote:

Hi, did you add the rack gem to your gem file?

-Conrad

Sent from my iPhone

Hi, Conrad

I find method of solution about “no such file to load – rack”

http://rvm.beginrescueend.com/integration/passenger/

=========================================

in /opt/nginx/conf/nginx.conf

passenger_ruby /home/wayne/.rvm/bin/passenger_ruby;

instead of

you current ruby version as “ruby 1.9.2-head…”

=========================================

and then when I input localhost:3002 in browser and click link - > About
your application’s environment

all right !

Ruby version 1.8.7 (i686-darwin10.0.0)
RubyGems version 1.3.6
Rack version 1.1
Rails version 3.0.0.beta2
Active Record version 3.0.0.beta2
Action Pack version 3.0.0.beta2
Active Resource version 3.0.0.beta2
Action Mailer version 3.0.0.beta2
Active Support version 3.0.0.beta2
Middleware
ActionDispatch::Static
Rack::Lock
Rack::Runtime
Rails::Rack::Logger
ActionDispatch::ShowExceptions
ActionDispatch::RemoteIp
Rack::Sendfile
ActionDispatch::Callbacks
ActionDispatch::Cookies
ActionDispatch::Session::CookieStore
ActionDispatch::Flash
ActionDispatch::ParamsParser
Rack::MethodOverride
ActionDispatch::Head
ActiveRecord::ConnectionAdapters::ConnectionManagement
ActiveRecord::QueryCache
Application root /Users/shajun/project_ree/testapp
Environment development
Database adapter postgresql
Database schema version 0