简体   繁体   English

RVM和缺少(但已安装)的宝石?

[英]RVM and missing (but installed) gems?

I'm trying to install a RVM on OSX 10.6.7 and start using it to sandbox my development enviorments on a per project basis but am having some issues. 我正在尝试在OSX 10.6.7上安装RVM并开始使用它在每个项目的基础上对我的开发环境进行沙箱化,但是我遇到了一些问题。

I have RVM installed and have created a gemset for Rails 2.3.11 and have made sure all the needed gems are installed with gem list: 我安装了RVM并为Rails 2.3.11创建了一个gemset,并确保所有需要的gem都安装了gem list:

actionmailer (2.3.11)
actionpack (2.3.11)
activemodel (3.0.7)
activerecord (3.0.7, 2.3.11)
activeresource (2.3.11)
activesupport (3.0.7, 2.3.11)
acts_as_commentable (3.0.1)
ajaxful_rating (2.2.8.2)
arel (2.0.9)
authlogic (3.0.2)
builder (2.1.2)
geokit (1.5.0)
i18n (0.5.0)
mysql (2.8.1)
rack (1.1.2)
rails (2.3.11)
rake (0.8.7)
rbbcode (0.1.11)
sanitize-url (0.1.4)
tzinfo (0.3.27)
will_paginate (2.3.15)

But when I start the server (script/server) I get the following error: 但是当我启动服务器(脚本/服务器)时,我收到以下错误:

Missing these required gems:   
authlogic  

You're running:    
ruby 1.8.7.334 at /Users/Nick/.rvm/rubies/ruby-1.8.7-p334/bin/ruby 
rubygems 1.6.2 at /Users/Nick/.rvm/gems/ruby-1.8.7-p334, /Users/Nick/.rvm/gems/ruby-1.8.7-p334@global

Run `rake gems:install` to install the missing gems.

Running rake gems:install doesn't seem to help. 运行rake gems:安装似乎没有帮助。 'which' gives me the following paths: '这'给了我以下路径:

which ruby         
/Users/Nick/.rvm/rubies/ruby-1.8.7-p334/bin/ruby 
which gem 
/Users/Nick/.rvm/rubies/ruby-1.8.7-p334/bin/gem

Any idea what is going on here? 知道这里发生了什么吗?

Ok I figured it out! 好吧我明白了!

There is a new version of authlogic that is only compatible with rails 3. Since the new rvm gemset needed to install authlogic it just grabbed the most current version available. 有一个新版本的authlogic只与rails 3兼容。由于新的rvm gemset需要安装authlogic,它只是抓住了最新版本。 To fix I just needed to include the correct version for rails 2 in my environment.rb file: 要修复我只需要在我的environment.rb文件中包含rails 2的正确版本:

config.gem "authlogic", :version => '2.1.6'

The error message was kind of misleading in this case. 在这种情况下,错误消息有点误导。 Gem was installed just not a version supported by rails 2. Gem安装的不是rails 2支持的版本。

Same shell session? 相同的shell会话? RVM can trip you up because you can use different gemsets/rubies in different shell sessions in the same directory, so if you run the server in a tab/window/session other than the one you're running which in, it might not be accurate. RVM会让你失望,因为你可以在同一个目录中的不同shell会话中使用不同的gemsets / rubies,所以如果你在一个选项卡/窗口/会话中运行服务器而不是你正在运行的which ,它可能不是准确。

Also, if you're using .rvmrc note that it is only loaded when you actually cd into the directory, and then only for the current shell session. 另外,如果你使用.rvmrc注意,它只是加载当你真正cd进入目录,然后只对当前shell会话。 If you have another session open when creating .rvmrc , it won't automatically apply for that session. 如果在创建.rvmrc时打开了另一个会话,则它不会自动应用于该会话。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM