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

1
  • 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. Commented Sep 1, 2017 at 6:56

1 Answer 1

16

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

//= require popper
//= require turbolinks
//= require bootstrap
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.