1

我对 Rails 游戏还很陌生;我是一名前端开发人员,自学编程。我已经构建了一个 Web 应用程序,并决定使用RailsKit SaaS工具包来处理我的注册等。我在启动和运行默认应用程序时遇到了问题,但我确定这是由于我缺乏知识,我认为这与设置 mysql 服务器有关(通常我使用 sqlite3,但这并不似乎也不适用于此应用程序)。

这是我遇到的过程和错误,我仍然无法创建数据库或启动服务器......

  1. 下载了应用程序

  2. 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 服务器。

任何为我指明正确方向的帮助都是好人!对此,我真的非常感激。

4

2 回答 2

0

在安装 mysql2 gem 之前,您需要在系统中安装 mysql 客户端和服务器。所以试试这个。

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

在此之后尝试安装 gem mysql2

于 2012-11-24T04:04:50.653 回答
0

bundle exec rake db:migrate这听起来像。

于 2012-11-24T03:02:21.507 回答