gpt4 book ai didi

ruby-on-rails - 为什么 Rails 使用错误版本的 Ruby?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:15:50 26 4
gpt4 key购买 nike

我有一台装有 Ruby 1.9.3 和 Rails 3.2.3 的 Centos6 服务器。我使用 RVM。然后我安装了 ruby​​ 2.0.0 和 rails 4.0.0。我用 RVM 更改了默认的 ruby​​ 版本。并使用 ruby --version 进行确认,然后我适本地更改了我的 Gemfile 并运行了 bundle install 和/或 bundle update如所须。一切都很好。然后我运行了 service httpd restart ,它起作用了,然后导航到我的网站并得到了以下信息:

Web 应用程序无法启动(Phusion Passenger 错误)

Could not find minitest-4.7.5 in any of the sources (Bundler::GemNotFound)
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/lib/phusion_passenger/loader_shared_helpers.rb:212:in `run_load_path_setup_code'
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:73:in `preload_app'
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:127:in `<module:App>'
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:6:in `<module:PhusionPassenger>'
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:5:in `<main>'

Environment variables
rvm_bin_path = /usr/local/rvm/bin
GEM_HOME = /usr/local/rvm/gems/ruby-1.9.3-p429
TERM = xterm
SHELL = /sbin/nologin
HISTSIZE = 1000
IRBRC = /usr/local/rvm/rubies/ruby-1.9.3-p429/.irbrc
PYTHONUNBUFFERED = 1
PASSENGER_ENV = production
PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.11360-47389796731312
SERVER_PORT = 80
MY_RUBY_HOME = /usr/local/rvm/rubies/ruby-1.9.3-p429
USER = nobody
REQUEST_URI = /
rvm_path = /usr/local/rvm
IN_PASSENGER = 1
RACK_ENV = production
REMOTE_PORT = 13101
rvm_prefix = /usr/local
PATH = /usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-2.0.0-p195/bin:/usr/local/rvm/gems/ruby-2.0.0-p195@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p195/bin:/usr/local/rvm/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin
MAIL = /var/spool/mail/nobody
WSGI_ENV = production
LANG = C
HISTCONTROL = ignoredups
rvm_env_string = ruby-1.9.3-p429
rvm_version = 1.20.13 (stable)
SHLVL = 2
HOME = /
RAILS_ENV = production
rvm_ruby_string = ruby-1.9.3-p429
SERVER_SOFTWARE = Apache/2.2.15 (CentOS)
LOGNAME = nobody
QUERY_STRING =
CVS_RSH = ssh
GEM_PATH = /usr/local/rvm/gems/ruby-1.9.3-p429:/usr/local/rvm/gems/ruby-1.9.3-p429@global
LESSOPEN = |/usr/bin/lesspipe.sh %s
SERVER_PROTOCOL = HTTP/1.1
REQUEST_METHOD = GET
RUBY_VERSION = ruby-1.9.3-p429
G_BROKEN_FILENAMES = 1
_ORIGINAL_GEM_PATH = /usr/local/rvm/gems/ruby-1.9.3-p429:/usr/local/rvm/gems/ruby-1.9.3-p429@global

但是在命令行运行 env 会显示这些:

GEM_HOME=/usr/local/rvm/gems/ruby-2.0.0-p195
MY_RUBY_HOME=/usr/local/rvm/rubies/ruby-2.0.0-p195
PATH=/usr/local/rvm/gems/ruby-2.0.0-p195/bin:/usr/local/rvm/gems/ruby-2.0.0-p195@global/bin:...and so on
GEM_PATH=/usr/local/rvm/gems/ruby-2.0.0-p195:usr/local/rvm/gems/ruby-2.0.0-p195@global
RUBY_VERSION=ruby-2.0.0-p195

我错过了什么?为什么 Rails 尝试使用错误版本的 ruby​​?

最佳答案

您需要使用您的目标 Ruby 重新编译 passenger:

rvm use 2.0.0
passenger_install_apache2_module

根据它给您的输出相应地更新您的 apache passenger 配置。

关于ruby-on-rails - 为什么 Rails 使用错误版本的 Ruby?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17415424/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com