2010-05-19 92 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