So, I was struggling at the last few hours about getting my bootstrap navbar to work in my rails 5.1.3 app. No success. I found a console error saying
Uncaught Error: Bootstrap dropdown require Popper.js
I was aware that bootstrap was dropping tether in favour of popper.js. I added it to the Gemfile
gem 'popper_js', '~> 1.11', '>= 1.11.1'
and it did nothing. Added to the application.js like this
//= require popper
and still nothing. After a while, I bumped into Joshua Colvin's answer about popper.js in Angular. After moving the popper line up in the code, like this
//= require popper //= require turbolinks //= require bootstrap
And got it to work. I wanted to share this to the community because it is a pretty recent topic and was very hard to find this fix. Hope this helps a lot of coders ;)
Just add require popper
before turbolinks and bootstrap like you said in the question
//= require popper //= require turbolinks //= require bootstrap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With