Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot load such file -- mysql2/mysql2

I am doing the installation on m1 mac and I am stuck mysql issue.

my rails server is working fine but when I run my spec then I got cannot load such file -- mysql2/mysql2 error

can someone help me here?

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
like image 774
Sajjad Murtaza Avatar asked Oct 18 '25 06:10

Sajjad Murtaza


1 Answers

I deleted my tmp/ folder and it's worked for me.

like image 53
Sajjad Murtaza Avatar answered Oct 20 '25 02:10

Sajjad Murtaza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!