ruby-on-rails - "Mysql2"0.5.2版本安装失败

标签 ruby-on-rails ruby

here的所有方法我都试过了. 但是,还是会出现同样的错误。

An error occurred while installing mysql2 (0.5.2), and Bundler cannot
continue.
Make sure that gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'
succeeds before bundling.

我的规范是:

  • MacOS Mojave 10.14.1

  • ruby 2.5.3p105

  • 带有自制软件的 Mysql 8.0.12

gem 文件:

gem "rails"
gem "mysql2", "0.5.2"

你能告诉我一个解决方案吗?

最佳答案

这是一个很好的帖子。我在使用 mac 时遇到了同样的问题。我最终做的是以下内容。

  1. 我更改了 Gemfile 的权限。我使用了 chmod 755 Gemfile

  2. 我使用了 sudo bundle install。这允许我在 Gemfile 中安装所有的 gem。

  3. 我做了一个rake db:createrails server

一切正常。希望它也能解决您的问题。

关于ruby-on-rails - "Mysql2"0.5.2版本安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53415815/

相关文章:

ruby-on-rails - 根据比较在 ruby​​ 中选择哈希

ruby - ruby、rspec 中的describe、it 和def 之间的区别

ruby - 使用正则表达式将数字更改为字符

ruby-on-rails - 大量的 WebSocket 连接

jquery - Rails UJS 确认框取消按钮回调

html - 如何编写一个停止/中断无限循环 Rails 应用程序的 Web 按钮?

mysql - 如何将数组变量添加到数据库表中

sql - 如何在 Rails 事件记录查询中执行条件计数?

ruby-on-rails - 从表单服务器端 Ruby on Rails 创建文本文件

android - 在 Android 平板电脑上开发 Ruby