2

当我尝试命令 rake db:migrate 时出现以下错误

> NOTE: Gem.source_index is deprecated, use Specification. It will be
> removed on or after 2011-11-01. Gem.source_index called from
> /home/hilarl/workspace/depot/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
> NOTE: Gem::SourceIndex#initialize is deprecated with no replacement.
> It will be removed on or after 2011-11-01. Gem::SourceIndex#initialize
> called from
> /home/hilarl/workspace/depot/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
> /home/hilarl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/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
> /home/hilarl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/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
> /home/hilarl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/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
> /home/hilarl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/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
> /home/hilarl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/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
> /home/hilarl/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
> WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require
> 'rdoc/task' (in RDoc 2.4.2+)' instead.
>     at /home/hilarl/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
> rake aborted! can't activate activesupport-3.2.3, already activated
> activesupport-2.3.14
> 
> (See full trace by running task with --trace)

知道为什么会这样吗?我正在使用 ubuntu,在我的系统上安装了 ruby​​ 1.9.3-p194 和 rails 2.3.14 并使用 sqlite3

4

2 回答 2

1

你能试着跑步吗

bundle exec rake db:migrate

您可以在系统中安装同一个 gem 的不同版本 - 因此 bundle exec <command> 使用与您的项目 Gemfile 绑定的 gem(在 Gemfile.lock 文件中搜索您的 gem 以查看正在使用的版本)。

更好的做法是创建 gemsets 来打包选择的 gems 版本,这些版本将根据上下文中的项目被激活。

http://bcardarella.com/post/699582642/rvm-gemsets-bundler-awesome

于 2012-05-23T04:40:06.000 回答
1

检查您安装了哪些版本的 rails:

$ gem list rails

*** LOCAL GEMS ***

rails (3.2.3, 2.3.14)

你应该像我在这里做的那样拥有多个 3.2.3 和 2.3.14

之后卸载你不需要的那些:

$ gem uninstall rails -v2.3.14
Remove executables:
    rails

in addition to the gem? [Yn]  Y
Removing rails
Successfully uninstalled rails-2.3.14

最后你应该只有一个版本的rails:

$ gem list rails

*** LOCAL GEMS ***

rails (3.2.3)
于 2012-05-23T06:10:40.080 回答