2012-11-24 83 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 

在此之后尝试

相关问题