Passenger with nginx: cannot load such a file - bundler / setup (LoadError)

Only one version of Ruby is installed, and I launched gem install bundler && bundle install .

nginx conf

 passenger_root /root/.gem/ruby/2.1.0/gems/passenger-4.0.52; passenger_ruby /usr/bin/ruby; server { listen 80; server_name example.com; root /srv/http/myrailsapp/public; passenger_enabled on; rails_env development; } 

Error log

 cannot load such file -- bundler/setup (LoadError) /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/lib/phusion_passenger/loader_shared_helpers.rb:263:in `block in run_load_path_setup_code' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/lib/phusion_passenger/loader_shared_helpers.rb:366:in `running_bundler' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/lib/phusion_passenger/loader_shared_helpers.rb:261:in `run_load_path_setup_code' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:100:in `preload_app' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:158:in `<module:App>' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>' /root/.gem/ruby/2.1.0/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:28:in `<main>' 
+6
source share
4 answers

I am solving a similar problem.

My problem was the configuration of passenger_ruby /usr/bin/ruby; Which indicates the wrong version. My solution was to set the path to which ruby

On the server I use rvm. But there are other ruby ​​settings.

First try to test the environment. Go to the application directory and run passenger start . This will show you if the server is ready to run the application. Correct the mistakes...

If the message still says that

 cannot load such file -- bundler/setup (LoadError) 

run gem install bundler and recheck.

Then configure the path to NGINX along the path from the command which ruby and restart the application.

+10
source

You need to change the value of passenger_root . As here in the document

For example, my nginx configuration:

 ... passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini; passenger_ruby /usr/bin/ruby; ... 
+1
source

There was a similar question only an hour ago. Check out my answer here: fooobar.com/questions/975990 / ...

0
source

The phusion passenger could not find the ruby ​​path, see if the ruby ​​path is correct or the symbolic link was deleted in the server update or for another reason.

CentOS 7 Ruby 2.6.3 Rbenv

 which ruby # ~/.rbenv/shims/ruby sudo rm /usr/bin/ruby # old ruby sudo ln -s ~/.rbenv/shims/ruby /usr/bin/ruby # 2.6.3 /usr/bin/ruby -v # ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] sudo service nginx restart 
0
source

Source: https://habr.com/ru/post/975989/


All Articles