Elton's Blog

Ruby on Rails: RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)

by Elton on 2010年03月7日, under Rails

当你升级了rails后,有时候会出现rack版本跟rails版本不匹配的情况。 当你执行./script/generate命令的时候,会出现以下错误信息:

  1.  
  2. /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks‘: RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)
  3.         from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process’
  4.         from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send
  5.         from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run’
  6.         from /Volumes/Data/study/ruby/blog/config/environment.rb:9
  7.         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require
  8.         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
  9.         from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1
  10.         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require
  11.         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
  12.         from ./script/generate:3
  13.  

解决方案:

  1.  
  2. $ sudo gem uninstall rack
  3.  
  4. Select gem to uninstall:
  5.  1. rack-1.0.0
  6.  2. rack-1.1.0
  7.  3. All versions
  8. > 1
  9.  
  10. You have requested to uninstall the gem:
  11.         rack-1.0.0
  12. actionpack-2.3.5 depends on [rack (~> 1.0.0)]
  13. actionpack-2.3.4 depends on [rack (~> 1.0.0)]
  14. If you remove this gems, one or more dependencies will not be met.
  15. Continue with Uninstall? [Yn]  y
  16. Successfully uninstalled rack-1.0.0
  17.  

然后再执行

  1.  
  2. sudo gem install -v=2.3.5 rails
  3.  
  4. Successfully installed rack-1.0.1
  5. 1 gem installed
  6. Installing ri documentation for rack-1.0.1
  7. Installing RDoc documentation for rack-1.0.1
  8.  

问题解决

相关文章:

  1. 在snow leopard上编译Ruby, RubyGems, 和Rails
  2. Snow Leopard下,为Rails升级
  3. Mac 下基于ruby 1.9安装Rails
  4. Gentoo下Nginx+thin构建rails环境
  5. Leopard下手工安装ruby,rails和mysql
:, ,

42 Comments for this entry

1 Trackback or Pingback for this entry

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit my friends!

A few highly recommended friends...