2012-11-24 88 views
1

我對Rails遊戲相當陌生;我是一位教我自己編程的前端開發人員。我已經構建了一個Web應用程序,並決定使用RailsKit SaaS工具包來處理我的註冊等。我有問題只是讓默認的應用程序啓動並運行,但我確信這是由於我缺乏知識,我認爲這與設置mysql服務器有關(通常我使用sqlite3,但這並不是' t似乎也適用於這個應用程序)。讓RailsKits SaaS應用啓動並運行w/mysql2服務器

具體的過程和我遇到的錯誤,我仍然不能甚至創建一個數據庫或啓動服務器...

  1. 下載應用程序

  2. Ran bundle install得到了以下錯誤:

    Gem::InstallError: factory_girl requires Ruby version >= 1.9.2. 
    An error occurred while installing factory_girl (4.1.0), and Bundler cannot continue. 
    Make sure that `gem install factory_girl -v '4.1.0'` succeeds before bundling. 
    
  3. 發現我對Ruby的版本1.8.7運行,因此我已將此添加到Gemfile中:

    gem 'rake','1.9.2' and **updated my system** to 1.9.2 
    
  4. bundle install,得到了出現以下錯誤:

    An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. 
    Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling. 
    
  5. 於是我就gem install mysql2 -v '0.3.11並得到了以下錯誤:

    ERROR: Error installing mysql2: 
    ERROR: Failed to build gem native extension. 
    
    /Users/trevanhetzel/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb 
    checking for rb_thread_blocking_region()... yes 
    checking for rb_wait_for_single_fd()... yes 
    checking for mysql_query() in -lmysqlclient... no 
    checking for main() in -lm... yes 
    checking for mysql_query() in -lmysqlclient... no 
    checking for main() in -lz... yes 
    checking for mysql_query() in -lmysqlclient... no 
    checking for main() in -lsocket... no 
    checking for mysql_query() in -lmysqlclient... no 
    checking for main() in -lnsl... no 
    checking for mysql_query() in -lmysqlclient... no 
    checking for main() in -lmygcc... no 
    checking for mysql_query() in -lmysqlclient... no 
    *** extconf.rb failed *** 
    Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. 
    

所以這是我在哪裏。如果這會有所幫助,畢竟上面的步驟,我試圖通過rake db:create創建一個數據庫,並得到了

Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine. 

所以我猜MySQL是沒有安裝在我的機器上?似乎有點奇怪的原因,我一直使用MAMP的MySQL服務器。

任何幫助指引我在正確的方向將是偉大的傢伙!對此,我真的非常感激。

+0

您正在使用哪個操作系統安裝寶石mysql2?對於OSX看到這個答案:http://stackoverflow.com/questions/4115126/ruby-gem-mysql2-install-failing – doesterr

+0

OSX。我雖然過去了,現在可以啓動服務器。遷移時出現此錯誤: 'Trevan-Hetzels-MacBook-Pro:V4 trevanhetzel $ rake db:create db:migrate saas:bootstrap rake aborted! 未定義的方法'trial_interval'爲# /Users/trevanhetzel/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:407: in'method_missing' /Users/trevanhetzel/.rvm/gems/ruby-1.9。3-p327/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:149:在'... –

+0

此問題是由於Kit隨附的遷移中缺少字段。這已被修復。 :) –

回答

0

bundle exec rake db:migrate聽起來像。

+0

'bundle exec rake db:migrate'現在給我這個: /Library/Ruby/Gems/1.8/gems/saas-kit-2.5.4/lib/saas/extensions/active_merchant/billing/gateways/paypal.rb :31:警告:已經初始化常量RECURRING_ACTIONS /Library/Ruby/Gems/1.8/gems/saas-kit-2.5.4/lib/saas/extensions/active_merchant/billing/gateways/paypal_express_recurring.rb:12:warning:already初始化常量LIVE_REDIRECT_URL /Library/Ruby/Gems/1.8/gems/saas-kit-2.5.4/lib/saas/extensions/active_merchant/billing/gateways/paypal_express_recurring.rb:13:警告:已經初始化常量TEST_REDIRECT_URL –

+0

可以嗎通過使用'bundle exec rails c'訪問控制檯......你不應該看到一個錯誤,但像一個閃爍的光標,也許1>或類似的東西。另外,'mysql -u root'來查看你的機器上是否有mysql。你選擇了一個不錯的話題來挑選你的第一個兄弟:-) – pjammer

+0

是的,我可以訪問控制檯。 'mysql -u root'給了我一個找不到的命令,所以它顯然不在我的機器上。 我想我會堅持使用sqlite3,因爲它的工作(除了上面的錯誤)。 而且我知道,對吧?我傾向於通過把自己扔在瘋狂的廢話中並試圖游出它來學習:) –

0

在安裝mysql2 gem之前,您需要在您的系統中安裝mysql客戶端和服務器。所以試試這個。

$sudo apt-get update 
    $sudo apt-get install mysql-server mysql-client 

在此之後嘗試

相關問題