22

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 ;)

rtrigo
  • 519
  • 1
  • 6
  • 16
  • 3
    You should add this as an answer to your post so you get more points and so it's more obvious there is an answer to your "question". It was really helpful though, thanks. – Arel Sep 01 '17 at 06:56

1 Answers1

16

Just add require popper before turbolinks and bootstrap like you said in the question

//= require popper
//= require turbolinks
//= require bootstrap
H.Elsayed
  • 431
  • 2
  • 11