简体   繁体   English

Gem.source_index已过时,请使用Specification。 我应该重新安装Gem或Rails吗?

[英]Gem.source_index is deprecated, use Specification. Should I re-install Gem or Rails?

I'm learning RoR on Ubuntu 11. Got the following message when I was trying to generate an app. 我正在Ubuntu 11上学习RoR。当我尝试生成应用程序时,收到以下消息。 Did I install something incorrectly? 我安装不正确吗?

$ rails generate controller Pages home contact
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/shared_helpers.rb:3.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/source.rb:162.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/source.rb:162.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/shared_helpers.rb:84.

This worked for me: downgrade rubygems: 这对我有用:降级红宝石:

gem update --system 1.6.2

found this advice at: Gem.source_index is deprecated, use Specification #34 在以下位置找到了此建议: Gem.source_index已过时,请使用规范#34

Try this: 尝试这个:

sudo gem update bundler

This will update bundler to most recent version (currently 1.0.15). 这会将捆绑程序更新为最新版本(当前为1.0.15)。 This will not generate the warning or at least in my case this was the cause of the warning. 这不会生成警告,或者至少在我看来,这是警告的原因。

The best way to solve this is: 解决此问题的最佳方法是:

$ gem pristine --all --no-extensions

This will rebuild all gems (excluding those with native extensions) and update their gemspecs. 这将重建所有gem(不包括具有本机扩展名的gem)并更新其gemspec。 If you don't have any gems with native extensions or you didn't use any custom compile flags on those gems you can also omit the --no-extensions flag. 如果您没有任何具有本机扩展的gem,或者您没有在这些gem上使用任何自定义的编译标志,则也可以省略--no-extensions标志。 Otherwise you'll have to build them seperately. 否则,您将不得不分别构建它们。

I tried "sudo gem update". 我尝试了“ sudo gem update”。 After that, I don't see the message "Gem.source_index is deprecated, use Specification..." anymore. 在那之后,我再也看不到消息“ Gem.source_index已过时,请使用Specification ...”。 Yay! 好极了!

rails -v = 2.2.2 导轨-v = 2.2.2

ruby -v = 1.8.7 红宝石-v = 1.8.7

This link helps me. 此链接对我有帮助。

or simply do 或干脆做

gem update --system 1.6.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 `add_frozen_gem_path':Gem的未定义方法`source_index':模块(NoMethodError)或不推荐使用Gem.source_index - `add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError) OR Gem.source_index is deprecated 如何“重新安装”宝石? - How to “re-install” a gem? Bundler希望重新安装Rails Engine作为gem - Bundler wants to re-install rails engine as gem rails-茉莉花-“注意:有宝石吗? 不推荐使用,请使用Specification :: find_by_name。” - rails - jasmine - “NOTE: Gem.available? is deprecated, use Specification::find_by_name.” 我是否需要安装Gem for jquery才能使用Rails? - Do I have to install Gem for jquery to use it Rails? 我应该使用哪种Rails gem来进行Resque的周期性工作? - What Rails gem should I use to make recurring jobs with Resque? 我应该在Rails 3.1项目中使用什么JSON gem? - What JSON gem should I use in a Rails 3.1 project? 宝石安装错误,找不到索引,在轨道上的红宝石 - gem install error, index not found, ruby on rails 我应该在CouchDB上运行Rails 3使用哪个身份验证gem /插件? - Which authentication gem/plugin should I use for Rails 3 running on CouchDB? 我应该在rails 3中使用boolean fields还是state_machine gem? - Should I use boolean fields or state_machine gem in rails 3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM