DEV: cannot load such file -- omniauth/strategies/oauth2 (LoadError)

All of a sudden, after doing a git pull into my discourse dev env on mac, getting this error after a successful bundle install when I try any rake or rails command.

gems/activesupport- `require': cannot load such file -- omniauth/strategies/oauth2 (LoadError)

Have tried removing all gems, starting over, reinstalling from scratch, nothing works; keep getting the same error.

Can I just disable this oauth2 stuff in dev?

This works fine:

cd ./discourse
bundle install

but when I try, for example:

$ bundle exec rake db:create
rake aborted!
LoadError: cannot load such file -- omniauth/strategies/oauth2

It’s been like this all night, without sleep!

Please tell me how to get past this roadblock which just appeared today.

1 Like

Hey @DBHacker

Sorry to hear you are having issues with dev on macOS. It’s definitely tricky.

Just for you, I logged into one of my mac minis which has never had rails (or discourse) installed; it was a total virgin macos which I use for a file server only.

I followed the macOS dev install from scratch; and had the usual problems with directory permissions and the seemingly always pesky cppjieba_rb gem; but it did install and finally:

So, it looks like @DBHacker, you have some corruption on your dev setup, because I was able to install from scratch on a virgin mac today.

Hope this helps you in some small way as a another data point.

… and now, I have another working discourse dev set up on a mac mini :wink:

Cheers and good luck getting things up and running again!


Wow @neounix !!

Thanks for taking your valuable time to do that!

This mac is far from virgin, and after reading your reply, tirelessly tried reinstalling from “scratch” with Ruby 2.7,1, 2.6.1 and 2.6.5, with different errors related to bootsnap each time.

Simple Rails apps generated new work fine; and Discourse bundle works fine; but when I start Rails I keep getting bootsnap errors.

Was going to wipe out Ruby and Rails completely and start over with a clean slate but have other Rails projects on going and so will put learning and hacking Discourse plugins on the sidelines for now.

Thanks again @neounix for taking the time to help and showing me it works on a virgin machine.

1 Like

No worries. I enjoyed building another Discourse dev environment on one of my file servers :slight_smile:

Glad it helped you out, in some small way.

1 Like

Thank you for that image of your versions @neounix :smiling_face_with_three_hearts:

Since the macos dev install script did not upgrade or install properly for some reason (guessing because the install was older and not virgin, but not sure, but ran it many times, left and right); I just manually upgraded both Ruby using rvm (this guide):

and then updated the Rails gem manually to version; and ran bundle again in the ./discourse directory:

Thank you so much !!! :smiling_face_with_three_hearts: