一台服务器有两个用户。 deploy
具有sudo特权,guest
没有。
guest虚拟机的应用程序正在将ruby版本(从2.3.4迁移到2.4.5)。
最初,来宾安装2.4.5版后,乘客无法启动,因为它找不到此版本的红宝石。 deploy
必须安装它。但是,启动服务器的下一个阶段无法加载应用程序,同时确认它正在deploy
用户目录中查找红宝石的版本
Error: The application encountered the following error: cannot load such file -- bundler/setup (LoadError)
/home/deploy/.rbenv/versions/2.4.5/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/deploy/.rbenv/versions/2.4.5/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:363:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:527:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-loader.rb:86:in `load_app'
/usr/share/passenger/helper-scripts/rack-loader.rb:116:in `block in <module:App>'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
/usr/share/passenger/helper-scripts/rack-loader.rb:115:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-loader.rb:28:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-loader.rb:27:in `<main>'
passenger-config --ruby-command
似乎正在寻找正确的目录,
passenger-config was invoked through the following Ruby interpreter:
Command: /home/guest/.rbenv/versions/2.4.5/bin/ruby
Version: ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]
但是,
rbenv exec gem environment gemdir
返回
/home/guest/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0
如何解决?
答案 0 :(得分:0)
这里的问题与调用的不同用户和红宝石版本有关。
passenger-config --ruby-command
在这种情况下返回有趣的段落:
To use in Nginx : passenger_ruby /home/guest/.rbenv/versions/2.4.5/bin/ruby
虽然nginx/sites-enabled/relevant_application
文件不需要为单个用户调用,但是对于多个用户来说,此命令是必需的。然后重启nginx!