[英]Passenger with nginx: cannot load such file — bundler/setup (LoadError)
There is only one version of Ruby installed, and I have run gem install bundler && bundle install
. 只安装了一个版本的Ruby,我运行了
gem install bundler && bundle install
。
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;
}
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>'
I have been solving similar issue. 我一直在解决类似的问题。
My problem was in configuration of passenger_ruby /usr/bin/ruby;
我的问题在于配置
passenger_ruby /usr/bin/ruby;
Which points to the incorrect version. 哪个指向不正确的版本。 My solution was to set the path to output of command
which ruby
我的解决方案是设置
which ruby
命令输出的路径
On the server I use rvm. 在服务器上我使用rvm。 But there are aslo other instalations of ruby.
但是还有其他红宝石的存在。
At first try to test the environment. 首先尝试测试环境。 Go to the application directory and run
passenger start
. 转到应用程序目录并运行
passenger start
。 This will show you you, if the server is ready to run the app. 如果服务器已准备好运行应用程序,这将向您显示。 Fix the errors...
修复错误......
If the message still says that 如果消息仍然这样说
cannot load such file -- bundler/setup (LoadError)
run gem install bundler
and re-check. 运行
gem install bundler
并重新检查。
Then set up the path in NGINX to path from which ruby
command and restart the appllication. 然后在NGINX中将路径设置为
which ruby
命令的路径并重新启动应用程序。
You need to change your passenger_root
value. 您需要更改您的
passenger_root
值。 Like here in doc 就像在doc中一样
For example my nginx config: 例如我的nginx配置:
...
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby;
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.