ruby-on-rails - 无法加载这样的文件 -- mysql2/mysql2

标签 ruby-on-rails ruby apple-m1

我正在 m1 mac 上进行安装,但遇到了 mysql 问题。

我的 rails 服务器工作正常,但是当我运行我的规范时,我得到了 cannot load such file -- mysql2/mysql2 错误

有人可以帮我吗?

rspec 规范/

An error occurred while loading rails_helper.
Failure/Error: require File.expand_path('../../config/environment', __FILE__)

LoadError:
  cannot load such file -- mysql2/mysql2
# ./config/application.rb:7:in `<top (required)>'
# ./config/environment.rb:2:in `require_relative'
# ./config/environment.rb:2:in `<top (required)>'
# ./spec/rails_helper.rb:4:in `<top (required)>'
No examples found.


Finished in 0.00003 seconds (files took 5.21 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

最佳答案

我删除了我的 tmp/ 文件夹,它对我有用。

关于ruby-on-rails - 无法加载这样的文件 -- mysql2/mysql2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71922488/

相关文章:

ruby-on-rails - capybara 测试中日期选择器的问题

ruby-on-rails - 如何获取 markitup 编辑器,使用 markdown set,发送 markdown 而不是 html

ruby-on-rails - 高效地重新安排 ActiveJob (resque/sidekiq)

ruby - 我可以包含/扩展模块但将所有包含/扩展的方法标记为私有(private)吗?

ruby-on-rails - 使用 capistrano 时如何阻止 bundle 程序在屏幕上显示密码?

ruby-on-rails - 将数据库表导出到YAML文件的最佳方法?

macos - 错误 : Could not find a version that satisfies the requirement tensorflow-text==2. 8.*(来自版本:无)

c++ - MacOS Big Sur M1 芯片,R devtool monocle3 安装期间出现 cmath 错误

python - 在 Apple Silicon/M1 上安装 python firebase-admin 失败,grpico 失败

ruby-on-rails - 在 Rails View 中查找模式并替换为链接的正确方法