Ruby on Rails, nginx, passenger on the production server (it is impossible to load such a file - rubygems / path_support)

I have installed:

  • Centos 6
  • Ruby 1.9.3-rc1
  • Passenger nginx gem and passenger module (compiled against native source 1.1.6)
  • Mounted Rails 3.1.0
  • Made / srv
  • Was there a new reils test
  • install package
  • made vhost for the passenger inside nginx based on the / srv / test / public example
  • nginx stop service && & nginx start service
  • ruby app loads okay index.html but then ...

After clicking the link "check application environment", which is inside the standard /public/index.html, I get this error

cannot load such file - rubygems / path_support

Question: Anyone know how I can resolve the cannot load such file -- rubygems/path_support error? Full error post below 

Ruby application (Rack) cannot be started. The source file that the application requires is missing. You may not have downloaded the application files correctly. Check if all your application files are uploaded. The required library cannot be installed. Please install all the libraries that are required for this application. Additional error information may be written to the application log file. Please check it to analyze the problem.

Error message: cannot load such file - rubygems / path_support

Exception Class: LoadError

Application Root: / srv / test

Backtrace:

 # File Line Location 0 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems.rb 392 in 'paths' 1 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems.rb 413 in 'path' 2 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 381 in 'dirs' 3 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 267 in '_all' 4 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 409 in 'each' 5 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 441 in 'find' 6 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb 441 in 'find_by_path' 7 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems.rb 203 in 'try_activate' 8 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 58 in 'rescue in require' 9 /usr/local/rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 35 in 'require' 10 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 241 in 'prepare_app_process' 11 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 155 in 'block in initialize_server' 12 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 572 in 'report_app_init_status' 13 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 153 in 'initialize_server' 14 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 204 in 'start_synchronously' 15 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 180 in 'start' 16 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 128 in 'start' 17 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 253 in 'block (2 levels) in spawn_rack_application' 18 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 132 in 'lookup_or_add' 19 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 246 in 'block in spawn_rack_application' 20 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 82 in 'block in synchronize' 21 prelude> 10:in 'synchronize' 22 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 79 in 'synchronize' 23 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 244 in 'spawn_rack_application' 24 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 137 in 'spawn_application' 25 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 275 in 'handle_spawn_application' 26 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 357 in 'server_main_loop' 27 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 206 in 'start_synchronously' 28 /usr/local/rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server 99 in '' 
+1
ruby ruby-on-rails compiler-errors rubygems
Oct 21 '11 at
source share
3 answers

I had a similar problem, although I had rvm and ruby ​​installed for only one user. For me, the solution was to verify that the application files belong to the same user for whom the ruby ​​was installed.

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#user_switching

+2
Nov 06 '11 at 19:33
source share

In my case, I also met this problem:
(My environment: Centos 5.8, rbenv 1.9.3p327, passenger 3.0.19, nginx (compiled and installed by the passenger). I googled around but did not find a direct answer (keyword: rbenv, passenger, cannot load such file -- rubygems/path_support ), so I am writing my solution here.

I checked and installed root for the nginx user, but it does not work. and changed all privileges of the gem folder to 777. It does not work.

Finally, I got a solution: add these 2 lines of code to your Nginx configuration file:

 passenger_default_user root; passenger_default_group root; 

now your nginx configuration file looks like this:

 # /opt/nginx/config/nginx.conf user root; # seems this line of code doesn't take effect. http { passenger_root /root/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/passenger-3.0.19; passenger_ruby /root/.rbenv/versions/1.9.3-p327/bin/ruby; # these lines are the key!!! passenger_default_user root; passenger_default_group root; server { listen 80; root <your_rails_project_public_folder>; passenger_enabled on; } } 
+2
Apr 3 '13 at 2:13
source share

I had the same problem. Timo is right.

your application should install the directory / home / rvm _user /.

Example:

 # vi /etc/conf/httpd.conf LoadModule passenger_module /home/rvm_user/.rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9/ext/apache2/mod_passenger.so PassengerRoot /home/rvm_user/.rvm/gems/ruby-1.9.3-rc1/gems/passenger-3.0.9 PassengerRuby /home/rvm_user/.rvm/wrappers/ruby-1.9.3-rc1/ruby <VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /home/rvm_user/your_application/public <Directory /home/rvm_user/your_application/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost> # chmod 755 /home/rvm_user/ # /etc/rc.d/init.d/httpd restart 
0
Nov 25 2018-11-11T00:
source share



All Articles