我已将Rails 2站点复制到生产服务器上,当我在生产服务器上运行脚本/服务器时,我得到以下内容:
-bash-3.2$ script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
/home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:50:in `refresh!': undefined method `full_name' for #<String:0x2aca6af0b4a0> (NoMethodError)
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:45:in `each'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:45:in `refresh!'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `new'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:298:in `add_gem_load_paths'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:132:in `process'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/spree/lib/spree/initializer.rb:90:in `run'
from /home/nwa36a/vhosts/aromapersona.localhost/config/environment.rb:13
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/railties/lib/commands/server.rb:84
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
我将所有宝石(包括依赖项)冻结到我的代码库中。
我必须将rack-1.0.1冻结到代码库中,并按照here所述修改vendor / rails / actionpack / lib / action_controller.rb。当我这样做时,我将rack-1.0.1 / rack.gemspec复制到rack-1.0.1 / .specification。我注意到该规范文件的格式与我冻结的其他gem的其他.specification文件的格式有点不同。这是一个正常的样本:
--- !ruby/object:Gem::Specification
name: hoe
version: !ruby/object:Gem::Version
prerelease: false
segments:
- 2
- 6
- 1
version: 2.6.1
platform: ruby
authors:
- Ryan Davis
autorequire:
bindir: bin
cert_chain:
和rack-1.0.1:
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{rack}
s.version = "1.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Christian Neukirchen"]
s.date = %q{2009-10-18}
s.default_executable = %q{rackup}
s.description = %q{Rack provides minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way $
s.email = %q{chneukirchen@gmail.com}
s.executables = ["rackup"]
s.extra_rdoc_files = ["README", "SPEC", "RDOX", "KNOWN-ISSUES"]
s.files = ["COPYING", "KNOWN-ISSUES", "README", "Rakefile", "bin/rackup", "contrib/rack_logo.svg", "example/lobster.ru", "example/protectedlobster.rb", "example/protectedlobste$
s.has_rdoc = true
s.homepage = %q{http://rack.rubyforge.org}
s.require_paths = ["lib"]
s.rubyforge_project = %q{rack}
s.rubygems_version = %q{1.3.1}
s.summary = %q{a modular Ruby webserver interface}
s.test_files = ["test/spec_rack_auth_basic.rb", "test/spec_rack_auth_digest.rb", "test/spec_rack_auth_openid.rb", "test/spec_rack_builder.rb", "test/spec_rack_camping.rb", "tes$
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
答案 0 :(得分:1)
我找到了解决方案。我没有意识到我有权访问该机器,因此,以root用户身份登录后,我发现gem-1.0.1已安装在该机器上。我删除了并安装了1.1.0,然后服务器启动就好了。然后我从我的项目中删除了rack-1.0.1。
真正的问题是我得到了
RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)
并且需要rack-1.1.0。我的有限用户帐户已安装1.1.0,但由于某种原因,系统尝试使用全局安装的任何内容。多么烦人。