5

我尝试运行 2.x 应用程序。我使用 rvm 并为此应用程序设置了其他版本的 ruby​​:

$ rvm use ree-1.8.7-head

我尝试运行服务器,然后出现很多错误:

   $ script/server
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
    NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#add_spec called from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
    NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#add_spec called from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
    NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#add_spec called from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
    Gem::SourceIndex#initialize called from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
    NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#add_spec called from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
    NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#add_spec called from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
    => Booting WEBrick
    => Rails 2.3.5 application starting on http://0.0.0.0:3000
    /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:268:in `==': undefined method `name' for "RedCloth":String (NoMethodError)
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `==='
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `matching_specs'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `find_all'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410:in `each'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/specification.rb:409:in `each'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `find_all'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `matching_specs'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238:in `to_specs'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems.rb:1210:in `gem'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:73:in `add_load_paths'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/initializer.rb:301:in `add_gem_load_paths'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/initializer.rb:301:in `each'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/initializer.rb:301:in `add_gem_load_paths'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/initializer.rb:132:in `process'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/config/environment.rb:26
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
        from /Users/serg/rails_projects_terminal/work_proj/spohelp/vendor/rails/railties/lib/commands/server.rb:84
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /Users/serg/.rvm/rubies/ree-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from script/server:4

我该如何解决?

宝石清单

$ gem list

*** LOCAL GEMS ***

actionmailer (3.2.3, 2.3.5)
actionpack (3.2.3, 2.3.5)
activemodel (3.2.3)
activerecord (3.2.3, 2.3.5)
activeresource (3.2.3, 2.3.5)
activesupport (3.2.3, 2.3.5)
addressable (2.2.8)
arel (3.0.2)
aws-s3 (0.6.2)
builder (3.0.0, 2.1.2)
bundler (1.1.3)
calendar_date_select (1.16.3)
cocaine (0.2.1)
desert (0.5.4)
diff-lcs (1.1.3)
erubis (2.7.0)
faker (0.3.1)
haml (3.2.0.alpha.10)
hike (1.2.1)
hoe (3.0.4)
hpricot (0.8.6)
htmlentities (4.3.1)
i18n (0.6.0)
icalendar (1.1.6)
jferris-mocha (0.9.5.0.1241126838)
journey (1.0.3)
json (1.7.0)
mail (2.4.4)
memcache-client (1.8.5)
memcached (1.4.1)
metaclass (0.0.1)
mime-types (1.18)
mocha (0.11.3)
multi_json (1.3.4)
newrelic_rpm (3.3.4.1)
nokogiri (1.5.3.rc5)
polyglot (0.3.3)
rack (1.4.1, 1.0.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3, 2.3.5)
railties (3.2.3)
rake (0.9.2 ruby, 0.8.7)
rbench (0.2.3)
rdoc (3.12)
RedCloth (4.2.9)
rspec (2.10.0)
rspec-core (2.10.0)
rspec-expectations (2.10.0)
rspec-mocks (2.10.0)
rspec-rails (2.10.0)
ruby-ole (1.2.11.3)
ruby-prof (0.11.0.rc3)
russian (0.6.0)
sequel (3.35.0)
spork (1.0.0rc2)
spreadsheet (0.6.9)
sprockets (2.1.3)
sqlite3 (1.3.6)
sqlite3-ruby (1.3.3)
test-unit (1.2.3)
text-format (1.0.0)
text-hyphen (1.0.2)
thor (0.14.6)
thoughtbot-factory_girl (1.2.2)
thoughtbot-shoulda (2.11.1)
tilt (1.3.3)
tmail (1.2.7.1)
treetop (1.4.10)
tzinfo (0.3.33)
validatable (1.6.7)
xml-simple (1.1.1)

导轨版本

$rails -v
Rails 2.3.5
4

1 回答 1

8

你的 RubyGem 版本是多少?Rails 2.3.X 与 RubyGem > 1.6 不兼容。我所有使用 Rails 2.3 的应用程序都使用 RubyGem 1.4.2 运行,因为它在使用 RubyGem 1.6 或更高版本时失败了。查看版本:gem -v

如果它高于 1.6,请在控制台中尝试:

gem uninstall rubygems-update #uninstall all rubygems-update version
gem install rubygems-update -v 1.4.2 #install rubygems-update version 1.4.2
update_rubygems #It will update you rubygem version with 1.4.2

并尝试运行script/server

我希望它有帮助

于 2012-05-04T09:46:47.050 回答