Rails功能失常,需要机架1.3.5,有1.4.0但无法安装1.3.5

时间:2012-01-09 20:54:01

标签: ruby-on-rails gem install rack

$ rails

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': RubyGem version error: rack(1.4.0 not ~> 1.3.5) (Gem::LoadError)
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
            from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
            from /usr/bin/rails:18

然后我试试这个:

$ sudo gem install rack 1.3.5

密码:

已成功安装rack-1.4.0

错误:无法在本地或存储库中找到gem 1.3.5

安装了1个宝石

为rack-1.4.0安装ri文档...

无法读取termcap数据库;

使用哑终端设置。

为rack-1.4.0安装RDoc文档...

然后再次但不同:

rails
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:230:in `activate': can't activate rack (~> 1.3.5, runtime) for ["actionpack-3.1.3", "rails-3.1.3"], already activated rack-1.4.0 for ["rack-cache-1.1", "actionpack-3.1.3", "rails-3.1.3"] (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
    from /usr/bin/rails:18

3 个答案:

答案 0 :(得分:8)

您必须安装机架1.3.5并删除机架1.4.0

sudo gem install rack -v 1.3.5
sudo gem uninstall rack -v 1.4.0

答案 1 :(得分:1)

安装特定版本的命令是

sudo gem install rack --version=1.3.5

你写的是试图找到一个名为1.3.5的宝石

答案 2 :(得分:0)

我相信它是因为机架宝石版本。

命令 gem list rack

它显示所有机架gems版本,之后我卸载了所有机架版本并运行bundle命令,希望您在Gemfile中指定所需的机架版本。

我相信它是因为如果你在Gemfile中指定一个机架版本,并且如果gems与一个大于那个版本的版本相同,那么我的错误就会出现。

因此,请尝试卸载所有机架gems并运行bundle命令。

希望它可能会有所帮助。