【发布时间】:2012-11-24 02:28:36
【问题描述】:
我对 Rails 游戏还很陌生;我是一名前端开发人员,自学编程。我已经构建了一个 Web 应用程序,并决定使用RailsKit SaaS 工具包来处理我的注册等。我在启动和运行默认应用程序时遇到了问题,但我确定这是由于我缺乏知识,我认为这与设置 mysql 服务器有关(通常我使用 sqlite3,但这并不似乎也无法使用此应用程序)。
这是我遇到的过程和错误,我仍然无法创建数据库或启动服务器...
已下载应用
-
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. -
发现我运行的是 Ruby 版本 1.8.7,所以我将其添加到 Gemfile:
gem 'rake','1.9.2' and **updated my system** to 1.9.2 -
跑
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. -
于是我跑了
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 服务器。
任何能帮助我指明正确方向的人都是好人!我真的很感激。
【问题讨论】:
-
您使用的是哪个操作系统?对于 OSX,请参阅此答案:stackoverflow.com/questions/4115126/…
-
OSX。我已经过去了,现在可以启动服务器了。迁移时出现此错误:'Trevan-Hetzels-MacBook-Pro:V4 trevanhetzel$ rake db:create db:migrate saas:bootstrap rake aborted!未定义方法
trial_interval' for # <SubscriptionPlan:0x007fd3243af9b8> /Users/trevanhetzel/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:407:inmethod_missing' /Users/trevanhetzel/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:149:in'...跨度> -
此问题是由于随套件提供的迁移中缺少字段。这已得到修复。 :)
-
@BenjaminCurtis 哦,好吧。迁移时仍然出现错误:
Trevan-Hetzels-MacBook-Pro:V4 trevanhetzel$ rake db:migrate rake aborted! undefined local variable or method `config' for main:Object /Sidecar/V4/config/application.rb:3 /Sidecar/V4/Rakefile:4 (See full trace by running task with --trace)并且无法启动服务器。我还需要做什么吗? -
@BenjaminCurtis 没关系,这是因为我将
config.assets.paths += ["app/assets/public"]添加到application.rb。我现在可以启动服务器,但仍然遇到上述关于未定义的 'trial_interval' 方法的错误。
标签: ruby-on-rails development-environment mysql2