我最近更新到了Ruby 2.5.3和Rails 5.2.1。这里是Gemfile:
source 'https://rubygems.org'
gem 'rails', '~> 5.2'
gem 'bootstrap-sass'
gem 'sassc-rails'
gem 'coffee-rails', '~> 4.2'
gem 'uglifier', '~> 3.0'
gem 'bcrypt', '~> 3.1'
gem 'jquery-rails', '~> 4.1'
gem 'turbolinks', '~> 5.0'
gem 'jbuilder', '~> 2.6'
gem 'bootstrap-datepicker-rails', '~> 1.6'
gem 'will_paginate', '~> 3.1'
gem 'd3-rails'
gem 'httparty', '~> 0.14'
gem 'nested_form_fields'
gem 'pg'
# XLSX format support
gem 'iconv'
gem 'write_xlsx'
gem 'roo'
# Authorisations
gem 'devise'
gem 'cancancan', '~> 2.0'
# MarkDown parser
gem 'redcarpet'
# eMail notification support
gem 'mailgun-ruby', '~>1.1'
# gem for dev and test only
group :development, :test, :eval do
gem 'annotate', '~> 2.7'
gem 'shoulda-matchers', '4.0.0.rc1'
gem 'rails-controller-testing'
gem 'rspec-rails', '~> 3.5'
gem 'factory_bot_rails'
gem 'capybara', '~> 2.7'
gem 'selenium-webdriver', '~> 2.53'
end
group :development do
gem 'web-console', '~>3.1'
gem 'listen', '~>3.0'
gem 'spring', '~>1.7'
gem 'spring-watcher-listen', '2.0'
end
据我所知,i18n包含在Rails 5中,但似乎缺少1.1.1版本。我运行捆绑程序更新,试图删除Gemfile.lock,直接安装gem i18n:
/var/www/dqm$ gem install gem install i18n
ERROR: Could not find a valid gem 'gem' (>= 0) in any repository
ERROR: Possible alternatives: gem
ERROR: Could not find a valid gem 'install' (>= 0) in any repository
ERROR: Possible alternatives: installr, go-install, insta, instacli, instana
Successfully installed i18n-1.1.1
但是乘客仍然会遇到这个问题。
(在WEBrick上启动应用程序没有问题。)
但是乘客返回以下错误:
在任何来源(Bundler :: GemNotFound)中都找不到i18n-1.1.1
具有以下跟踪信息:
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/spec_set.rb:91:in `block in materialize'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/spec_set.rb:85:in `map!'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/spec_set.rb:85:in `materialize'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/definition.rb:171:in `specs'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/definition.rb:238:in `specs_for'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/definition.rb:227:in `requested_specs'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/runtime.rb:108:in `block in definition_method'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/runtime.rb:20:in `setup'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:107:in `setup'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/setup.rb:20:in `<top (required)>'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/home/fred/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59: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-preloader.rb:91:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:189: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-preloader.rb:188: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>'
我该如何解决?欢迎提出任何想法...谢谢!
答案 0 :(得分:0)
实际上,在我的服务配置文件中,我还需要为Ruby设置一致的版本:2.5.3。我的虚拟主机声明应包含以下内容:
<VirtualHost *:80>
ServerName dqm.---.com
RailsEnv development
# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/dqm/public
PassengerRuby /home/fred/.rbenv/versions/2.5.3/bin/ruby
---
这解决了我的问题!