当你升级了rails后,有时候会出现rack版本跟rails版本不匹配的情况。 当你执行./script/generate命令的时候,会出现以下错误信息:
代码语言:javascript复制/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)
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /Volumes/Data/study/ruby/blog/config/environment.rb:9
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from ./script/generate:3
解决方案:
代码语言:javascript复制$ sudo gem uninstall rack
Select gem to uninstall:
1. rack-1.0.0
2. rack-1.1.0
3. All versions
> 1
You have requested to uninstall the gem:
rack-1.0.0
actionpack-2.3.5 depends on [rack (~> 1.0.0)]
actionpack-2.3.4 depends on [rack (~> 1.0.0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Successfully uninstalled rack-1.0.0
然后再执行
代码语言:javascript复制sudo gem install -v=2.3.5 rails
Successfully installed rack-1.0.1
1 gem installed
Installing ri documentation for rack-1.0.1...
Installing RDoc documentation for rack-1.0.1...
问题解决
- Previous 如何使用Objective-C解析HTML和XML
- Next 利用CSS3实现文字内阴影效果