2010-05-19 40 views
1

总ruby新手,试图在Mac OS X Snow leopard上安装Rails/MongoDB应用程序。乘客:“缺少这些所需的宝石红绿色”

安装的Ruby 1.9.1和RubyGems 1.3.7,which rubywhich gem指向同一个目录。我使用的是内置apache和Passenger 2.2.11的Snow Leopard。我正在使用mongo-site的导轨模板,这似乎总体上工作正常。

确切的错误乘客给予我的是:

/Users/User/Sites/feuerapp/vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement **Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance. You can install the extension as follows: gem install bson_ext If you continue to receive this message after installing, make sure that the bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version. Missing these required gems: redgreen You're running: ruby 1.9.1.376 at /usr/local/bin/ruby rubygems 1.3.7 at /Users/User/.gem/ruby/1.9.1, /usr/local/lib/ruby/gems/1.9.1 Run耙宝石:安装to install the missing gems.

奇怪的是,redgreen安装和看起来好像没什么问题:

Dahlia:feuerapp User$ ls -la vendor/gems/
total 0
drwxr-xr-x 7 User staff 238 May 18 22:56 .
drwxr-xr-x 5 User staff 170 May 18 23:00 ..
drwxr-xr-x 11 User staff 374 May 18 22:56 factory_girl-1.2.4
drwxr-xr-x 11 User staff 374 May 18 22:56 mocha-0.9.8
drwxr-xr-x 7 User staff 238 May 18 22:56 mongo_mapper-0.7.6
drwxr-xr-x 7 User staff 238 May 18 22:56 redgreen-1.2.2
drwxr-xr-x 11 User staff 374 May 18 22:56 shoulda-2.10.3

在environment.rb中注释掉这条线“解决”了这个问题,但这并不是我想要的:

config.gem 'redgreen'

我不明白宝石的任何东西,但从我有限的理解,红绿应该在那里找到?

+0

是否有一个原因明确地从您的环境调用redgreen?大多数使用redgreen的gem都会自己调用它,而不需要你明确地做它。我知道这并不真正回答你的问题,更多的是好奇心:) – theIV 2010-05-19 06:21:35

+0

@theIV不知道,我只是“盲目地”跟随提供的模板,希望这些人知道他们在做什么。我正在学习这些东西,并试图让一个网站开始运行,开始写我的第一个红宝石应用程序:) – 2010-05-19 06:24:06

回答

3

好吧,发现它,我错过了测试单元的宝石。

我是如何找到它的?我去了vendor/gems/redgreen-1.2.2/lib/redgreen.rb并查看了“require”语句,其中列出了“test/unit”。快速谷歌搜索引导我到测试单位的宝石,gem install test-unit现在工作。

我不确定是否可以告诉耙子有没有依赖关系,我有点失望,没有更好的错误信息,但至少现在已经解决了。

+0

很高兴你知道了。你是对的,因为这个错误消息让你不知道到底发生了什么。 :[ – theIV 2010-05-20 03:32:46

0

也许它并没有告诉你它正在寻找不同版本的gem,无论出于何种原因。如果您运行(sudo)耙宝石:安装并再试一次,您是否收到相同的消息?至少可以说,创业板依赖业务在屁股上有点痛苦。

此外,特别是对于这种情况,我会说删除redgreen不是世界的尽头。由于它特定于测试,因此您还可以将gem依赖项移动到environments/test.rb(或其他任何测试环境所设置的内容)中,而不必在开发/登台/生产中处理它。

任何依赖于测试的gem应该只针对您的测试环境而不是针对整个应用程序指定。

+0

是的,耙宝石:安装不会改变任何东西。我试过rm -rf vendor/gems并重新运行耙宝石:install/rake gems:unpack。它解开了redgreen-1.2.2的宝石。 – 2010-05-19 06:52:21