2011-06-27 84 views
1

精確地遵從教程,並試圖讓鐵軌服務器來運行,並得到以下錯誤:Rails服務器將無法運行 - 這是一個mysql2問題?

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
    Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3. 
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
    Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
    NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. 
    Gem::SourceIndex#each called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
    Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:84. 
    /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) 
     Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle 
     Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle 
     from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2.rb:9 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each' 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require' 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each' 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require' 
     from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler.rb:120:in `require' 
     from /Users/EricFriedman/Sites/simple_cms/config/application.rb:7 
     from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:28:in `require' 
     from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:28 
     from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:27:in `tap' 
     from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:27 
     from script/rails:6:in `require' 
     from script/rails:6 

回答

2

你需要的,如果你正在使用Rails 3.0.x的來鎖定您的mysql2版本在你的Gemfile:

gem "mysql2", "~> 0.2.11" 

然後運行bundle installbundle update mysql2

編輯

我注意到你使用0.2.11版本的mysql2寶石。

仔細看,我注意到了這個錯誤:

Library not loaded: libmysqlclient.18.dylib (LoadError)

這可能表明,MySQL的開發頭文件/庫不可用。當您運行bundle install時,您的安裝mysql2 gem應該失敗。如果是這樣,你需要安裝這些開發庫,然後重新安裝gem。

2
Library not loaded: libmysqlclient.18.dylib (LoadError) 

你需要在你的機器上安裝mysql。

如果你在終端輸入mysql會發生什麼?

如果鍵入 mysql --version到終端發生了什麼

+0

mysql 歡迎使用MySQL監視器。命令結束於;或\ g。 您的MySQL連接ID是3443 服務器版本:5.5.13 MySQL社區服務器(GPL) 版權所有(c)2000,2010,Oracle和/或其附屬公司。版權所有。 Oracle是Oracle Corporation和/或其子公司 的分支機構的註冊商標。其他名稱可能是其各自的 所有者的商標。 鍵入'help'或'\ h'尋求幫助。輸入'\ c'清除當前的輸入語句。 –

+0

mysql --version mysql Ver 14.14 Distrib 5.5.13,用於osx10.6(i386)使用readline 5.1 –

+0

是的,你需要gem的開發頭文件來編譯它看起來像,我不知道該怎麼做在mac上(你正在使用mac的權利?),但它不應該太難,去http://dev.mysql.com/downloads/mysql/,然後單擊開發版本選項卡,並下載適當的版本,作爲只要你安裝在系統默認位置,它應該工作 – loosecannon