簡體   English   中英

乘客配置未從 rvm 默認設置 ruby 版本

[英]passenger-config not set ruby version from rvm default

我已將 ruby 版本從 2.3.1 升級到 3.0.2 並進行了相關更改。 在服務器上,部署后,nginx 服務器無法啟動,老版本報錯。

我在 ubuntu 和 rvm 列表中檢查了 ruby 版本和登錄用戶,新的 3.0.2 版本設置為默認版本。

Error log: 
App 7441 stdout:
App 7441 stdout:
[ E 2021-10-19 03:59:51.9761 5027/T49 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/apprunner/application/current: An error occurred while starting up the preloader.
  Error ID: c6399257
  Error details saved to: /tmp/passenger-error-J6lyAl.html
  Message from application: You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/lockfile_parser.rb:72:in `warn_for_outdated_bundler_version'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/lockfile_parser.rb:59:in `initialize'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/definition.rb:61:in `new'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/definition.rb:61:in `initialize'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/dsl.rb:173:in `new'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/dsl.rb:173:in `to_definition'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/dsl.rb:11:in `evaluate'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/definition.rb:24:in `build'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler.rb:120:in `definition'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler.rb:88:in `setup'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>'
  /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2021-10-19 03:59:51.9814 5027/T7 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-25] Cannot checkout session because a spawning error occurred. The identifier of the error is c6399257. Please see earlier logs for details about the error.

不知道為什么錯誤是顯示版本 2.3.0?

如何從rvm將ruby版本設置為乘客?

乘客檢查 ruby 命令給出兩個不同的 output: 命令:passenger-config about ruby-command

  1. 使用 Sudo 用戶(未檢測到 rvm 命令):

 root@ip-:/usr/bin# passenger-config about ruby-command passenger-config was invoked through the following Ruby interpreter: Command: /usr/bin/ruby2.3 Version: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] To use in Apache: PassengerRuby /usr/bin/ruby2.3 To use in Nginx: passenger_ruby /usr/bin/ruby2.3 To use with Standalone: /usr/bin/ruby2.3 /usr/bin/passenger start The following Ruby interpreter was found first in $PATH: Command: /usr/bin/ruby Version: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] To use in Apache: PassengerRuby /usr/bin/ruby To use in Nginx: passenger_ruby /usr/bin/ruby To use with Standalone: /usr/bin/ruby /usr/bin/passenger start

  1. 系統用戶(檢測到 rvm 命令的登錄用戶):

 current$ passenger-config about ruby-command Your RVM wrapper scripts are too old, or some wrapper scripts are missing. Please update/regenerate them first by running: rvmsudo rvm get stable && rvm reload && rvmsudo rvm repair all If that doesn't seem to work, please run: rvmsudo rvm wrapper ruby-3.0.2 --no-prefix --all

請提供任何線索,如何設置乘客 ruby 默認版本或如何解決此錯誤。

由於乘客被設計為在一個網絡服務器上為多個(Rails)應用程序提供服務,因此每個虛擬主機(實際上是每個目錄)都有配置選項來設置每個應用程序的環境。

請參閱https://www.phusionpassenger.com/docs/references/config_reference/apache/https://www.phusionpassenger.com/docs/references/config_reference/nginx/

RVM 為每個已安裝的 ruby 安裝包裝器,即 ~/.rvm/wrappers/ruby-3.0.2/ruby,您可以告訴乘客將此 ruby 用於您的應用程序。

在 apache 配置中,您可以編寫:

<Directory "/path/to/you/rails/app">
  PassengerRuby "/home/your-user/.rvm/wrappers/3.0.2/ruby"
  RailsEnv production
</Directory>

乘客配置告訴你使用什么包裝器,但你必須首先設置 ruby 環境。 我的乘客配置輸出此評論:

RVM 用戶注意事項

您想知道哪個命令用於不同的 Ruby 解釋器嗎? 'rvm use' Ruby 解釋器,然后重新運行'passenger-config about ruby-command'。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM