无法加载此类文件 -- mysql2/mysql2

cannot load such file -- mysql2/mysql2

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

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

有人可以帮我吗?

rspec spec/

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/ 文件夹,它对我有用。