rbenv passenger cannot load such file — bundler/se

2019-09-02 04:30发布

问题:

My passenger is installed as a gem.
Nginx is installed by passenger-install-nginx-module.
There are 3 gemsets for ruby 2.1.1, the rubygemset rails4_1 is the correct one for this app.
Other posts show similar issues(1, 2, 3), but none of them resolves my problem.

[ 2014-09-29 14:29:17.1212 13182/7f32e5938700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/canoe/apps/app1: An error occured while starting up the preloader.
  Error ID: b57602d4
  Error details saved to: /tmp/passenger-error-jcmrkH.html
  Message from application: cannot load such file -- bundler/setup (LoadError)
  /home/canoe/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /home/canoe/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/lib/phusion_passenger/loader_shared_helpers.rb:263:in `block in run_load_path_setup_code'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/lib/phusion_passenger/loader_shared_helpers.rb:366:in `running_bundler'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/lib/phusion_passenger/loader_shared_helpers.rb:261:in `run_load_path_setup_code'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:158:in `<module:App>'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52/helper-scripts/rack-preloader.rb:28:in `<main>'


[ 2014-09-29 14:29:17.1372 13182/7f32e3814700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is b57602d4. Please see earlier logs for details about the error.

The passenger config in nginx,
passenger_root /home/canoe/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/passenger-4.0.52;
passenger_ruby /home/canoe/.rbenv/versions/2.1.1/bin/ruby;

Some output:
$ bundle -v
Bundler version 1.6.2

Exporting GEM_HOME to the gemset rails4_1 prior to launching nginx could not resolve the problem.

Any solution?

回答1:

Try installing the bundler gem globally.



回答2:

This is most likely an environment variable problem. Notice that the error message mentions "Error details saved to: ...filename..."? Open that file to see whether there are any suggestions, and double check whether the environment variables are correct.