如何使Ruby on Rails(Rails v4,Ruby v1.9.3)与MySQL一起使用

凯西

这是我已经尝试找到答案的地方:教程要点stackoverflow另一个堆栈溢出官方指南

我仍然不知道我在做什么错。正确配置database.yml后,我尝试创建项目,这是我得到的错误:

“请更新您的PATH以包括构建工具,或从' http://rubyinstaller.org/downloads '下载DevKit并按照' 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 Rails:4.0.0 Ruby: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.`
选择
  • 关闭端子,然后再次打开。
  • cd 到正确的目录。
  • 检查ruby版本(ruby -v)。
  • 检查rails版本bundle exec rails -v
  • 检查Gemfile存在。
  • 运行bundle
  • bundle exec rails s

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Ruby on Rails如何与Amazon RDS一起使用

如何使用Ruby on Rails关联?

如何“使用Ruby on Rails表单”

使Turbolinks包装器与Ruby on Rails Devise一起使用

如何在Windows 7上使Rails与较新版本的Ruby一起使用?

如何在Ruby on Rails中将form.select与jquery .click()方法一起使用?

Vim ruby,rails omnicompletion:“加载rails环境时出错”。如何配置vim-ruby的自动完成功能以与rails一起使用?

Ruby on Rails以及+ capistrano v3集成

如何在Ruby on Rails中使用Javascript?

如何使用Ruby on Rails发出HTTP请求?

如何在Ruby on Rails中使用Firebase?

如何在Ruby on Rails中使用XML

如何在Ruby on Rails中使用jTable?

如何使用Ruby Rails设置Twitter Bootstrap

Glass Mapper V4语言项回退,如何使其与Autofac一起使用?

如何使链接与Bootstrap v4中的card-img-overlay一起使用

如何将oneOf与常见子模式(V4)一起使用

如何设置 Ruby on Rails?

如何使用MenuItem导航?材质用户界面V1

如何使用Docker v1存储库

如何绕过(不建议使用)reCAPTCHA V1?

如何使用离子(v1)框架呈现弹出viewController?

如何在Ionic V1中使用FCM

mongo ruby diver UUID 格式好像和 uuid v4 不一样?

在Ruby on Rails中与Mongoid一起投票

如何在Ruby on Rails上使用Ruby上的小课程

如何在Ruby on Rails中将类方法链接在一起?

如何将模板与Ruby on Rails放在一起

如何让 rails 与 jruby 和 rvm 一起工作 - ruby 版本不断翻转