3

I have set up Rails, Passenger, nginx, and PostgreSQL on Ubuntu Server 12.04LTS. Upon trying to access the application/website, however, I am greeted with an error page saying that the application could not be started because a source file is missing. Error message: cannot load such file -- bundler.

My nginx config (/opt/nginx/conf/nginx.conf):

user railsapp;

worker_processes 1;
events {
  worker_connections 1024;
}

http {
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  keepalive_timeout 65;

  passenger_root /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14;
  passenger_ruby /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby;

  server {
     listen 80;
     server_name fitness_schedules.local;
     root /home/railsapp/fitness_schedules/public;
     passenger_enabled on;
     rack_env development;
  }
}

Here is the error message:

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: cannot load such file -- bundler

Exception class: LoadError

Application root: /home/railsapp/fitness_schedules

Here is the backtrace from the webpage that is presented by nginx:

Backtrace:
#   File    Line    Location
0   /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  36  in `require'
1   /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  36  in `require'
2   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/utils.rb   325 in `prepare_app_process'
3   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/application_spawner.rb    156 in `block in initialize_server'
4   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/utils.rb   563 in `report_app_init_status'
5   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/application_spawner.rb    154 in `initialize_server'
6   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
7   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 180 in `start'
8   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/application_spawner.rb    129 in `start'
9   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   253 in `block (2 levels) in spawn_rack_application'
10  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb  132 in `lookup_or_add'
11  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   246 in `block in spawn_rack_application'
12  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb  82  in `block in synchronize'
13      prelude>    10:in `synchronize'
14  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb  79  in `synchronize'
15  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   244 in `spawn_rack_application'
16  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   137 in `spawn_application'
17  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   275 in `handle_spawn_application'
18  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'
19  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'
20  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/helper-scripts/passenger-spawn-server    99  in `'

In ~/fitness_schedules/log there are only development and test logs, no production/development logs.

womble
  • 96,255
  • 29
  • 175
  • 230
Stuart
  • 151
  • 1
  • 4
  • Please provide `gem list` output – Alex Aug 09 '12 at 21:26
  • 2
    I found the answer right after I posted: In the /opt/nginx/conf/nginx.conf file, I had to replace passenger_ruby /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby with passenger_ruby /home/railsapp/.rvm/wrappers/ruby-1.9.3-p194/ruby Figures I'd find it right after posting the question... – Stuart Aug 09 '12 at 21:44
  • Post that as an answer, then, and accept it. Don't hide it in a comment. – womble Aug 09 '12 at 23:33
  • It happens to the best of us. Welcome to Server Fault. When the new user time limit expires, please answer your question by putting the answer in the answer section below, and then accept it by clicking the check mark. – Michael Hampton Aug 09 '12 at 23:33
  • @womble New users with low reputation have to wait 8 hours before answering their own question. – Michael Hampton Aug 09 '12 at 23:34
  • @MichaelHampton: Yes, I know that. Does the OP, though? – womble Aug 09 '12 at 23:35
  • @womble He will as soon as he reads these comments. :) – Michael Hampton Aug 09 '12 at 23:36
  • @MichaelHampton: Exactly. That's why I wrote my comment. – womble Aug 09 '12 at 23:36

1 Answers1

2

I found the answer right after I posted; sorry it took me awhile to get back to the question after 8 hour limit...

In the /opt/nginx/conf/nginx.conf file, I had to replace

passenger_ruby /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby

with

passenger_ruby /home/railsapp/.rvm/wrappers/ruby-1.9.3-p194/ruby
Stuart
  • 151
  • 1
  • 4