Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 5 - Uncaught Error: Bootstrap dropdown require Popper.js

Tags:

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

like image 588
rtrigo Avatar asked Aug 17 '17 13:08

rtrigo


1 Answers

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

//= require popper //= require turbolinks //= require bootstrap 
like image 79
H.Elsayed Avatar answered Sep 27 '22 22:09

H.Elsayed