【发布时间】:2013-10-01 04:12:24
【问题描述】:
以下是我已经尝试过寻找答案的地方: tutorials point、stackoverflow、another stack overflow 和 the official guide。
我仍然不知道我做错了什么。正确配置 database.yml 后,我尝试创建项目,这是我得到的错误:
“请更新您的 PATH 以包含构建工具或下载 DevKit 从 'http://rubyinstaller.org/downloads' 并按照说明进行操作 在'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
安装 mysql2 (0.3.13) 时出错,Bundler 无法继续。
在捆绑之前确保 gem install mysql2 -v '0.3.13' 成功。”
为什么找不到mysql2 v0.3.13?
操作系统:Windows 7 导轨:4.0.0 红宝石:1.9.3 已安装 DevKit
我遇到的错误
$ bundle exec rails s
Could not locate Gemfile
$ bundle
Bundler::GemfileNotFound
`$ gem install mysql2
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
c:/Ruby193/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/Ruby193/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
extconf.rb:37:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13 for inspection.`
【问题讨论】:
-
我安装了最新版本的 MySQL 5.x 或 6。我不知道如何找到。 Rails 一直说找不到 mysql2 gem。
-
这是我的 Gemfile 中的内容:
# Use mysql as the database for Active Record gem 'mysql2'。当我运行 bundle 时,这是输出:Bundler::GemfileNotFound -
关闭终端并再次打开。
cd到正确的目录。检查红宝石版本(ruby -v)。检查 Rails 版本bundle exec rails -v。检查Gemfile是否存在。运行bundle。运行bundle exec rails s。如果这些检查中的任何一个失败,请编辑问题并告诉我们究竟出了什么问题。复制粘贴您看到的实际错误。 -
这些都不起作用,我将错误粘贴到编辑中。我还需要发布更多内容吗?
-
请参阅如何将文本格式化为代码。您粘贴的文本不可读。
标签: mysql ruby ruby-on-rails-4