2012-05-23 109 views
2

我收到以下錯誤,當我嘗試的命令耙分貝:遷移入門試圖運行耙分貝時出現錯誤:遷移

> 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/[email protected]/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的,有紅寶石1.9.3-P194和導軌安裝2.3.14我的系統上,並使用sqlite3的

回答

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 

at th Ë結束時,你應該只有一個版本的軌道:

$ gem list rails 

*** LOCAL GEMS *** 

rails (3.2.3) 
+0

奇怪,我得到一個空的列表,但我絕對有軌龍頭安裝 hilarl @ isa009:〜/工作區/車廠$寶石列表軌 ***當地的寶石*** hilarl @ isa009:〜/工作區/車廠$ – hilarl

+0

確定它的工作,不得不重新安裝出於某種原因軌寶石。非常感謝 – hilarl

1

你可以嘗試運行

bundle exec rake db:migrate

你可以有不同版本的同一寶石安裝在您的系統中 - 因此bundle exec <command>使用其版本與您的項目綁定的gem Gemfile(在Gemfile.lock文件中搜索您的gem以查看正在使用的版本)。

更好的做法是創建gemset來打包選擇的gem版本,這些gemset將根據上下文中的項目激活。

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

+0

當我嘗試,我得到「無法定位的Gemfile」 – hilarl