无法加载此类文件 -- mysql2/2.4/mysql2 (LoadError) - windows [英] cannot load such file -- mysql2/2.4/mysql2 (LoadError) - windows

查看:31
本文介绍了无法加载此类文件 -- mysql2/2.4/mysql2 (LoadError) - windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Ruby on Rails 的新手.我的 Ruby 版本是 ruby​​ 2.4.1p111(2017-03-22 修订版 58053)[x64-mingw32].

I am new on Ruby on Rails. My Ruby version is ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32].

我使用 rails new sample_cms -d mysql 命令创建了一个新项目.

I have created a new project using rails new sample_cms -d mysql command.

rails server 命令抛出以下错误.

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.4/mysql2 (LoadError)

我已经安装了 mysql 和 mysql Connector C.我已经安装了这样的 mysql2 gem.

I have installed mysql and mysql Connector C. I have installed the mysql2 gem like that.

gem install mysql2 —platform=ruby — ‘—with-mysql-dir="C:Program FilesMySQLMySQL Connector C 6.1"’

我已经卸载并安装了 mysql2 gem,但仍然遇到问题.这是可能有问题的目录.

I have uninstall and install the mysql2 gem but still facing the issue. Here is the directory which may have issue.

目录图片

这里是mysql2的gem文件入口

Here is the gem file entry for mysql2

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5'
# Use Puma as the app server
gem 'puma', '~> 3.7'

有什么帮助吗?

推荐答案

目前没有适用于 Windows 的 Ruby 2.4 的 mysql2 二进制文件.所以我卸载了 ruby​​ 2.4 并安装了 ruby​​ 2.3.现在它运行良好

There is no mysql2 binary for Ruby 2.4 for Windows available at this time. So i uninstall ruby 2.4 and install ruby 2.3. Now it is working well

这篇关于无法加载此类文件 -- mysql2/2.4/mysql2 (LoadError) - windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆