Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install popper.js with Bootstrap 4?

From what I've read so far, popper.js is a big pain with Bootstrap 4. I can't get it to work. I keep getting this error:

Error: Bootstrap dropdown require Popper.js (https://popper.js.org)

I've tried the CDN and NPM install. Same result. At the bottom of my HTML file, I have this for the NPM install:

<script src="js/jquery.min.js"></script> <script src="js/popper.min.js"></script> <script src="js/tether.min.js"></script> <script src="js/bootstrap.min.js"></script> 

Then tried this for the CDN:

<script src="/js/jquery.min.js"></script> <script src="/js/tether.min.js"></script> <script src="https://cdnjs.com/libraries/popper.js"></script> <script src="/js/bootstrap.min.js"></script> 

Any ideas what I'm doing wrong?

like image 830
4thSpace Avatar asked Oct 31 '17 16:10

4thSpace


People also ask

Does bootstrap 4 require Popper js?

However, Bootstrap 4 can be used without Popper. js, if we don't use tooltips, popovers nor dropdowns. For example, navbar's JS functionality (mobile menu on the right) works well without Popper. js.

Do I need to install popper for bootstrap?

Bootstrap depends on Popper, which is specified in the peerDependencies property. This means that you will have to make sure to add both of them to your package.

How do I get Popper js?

The official way to install Popper. js is trough npm, Yarn or NuGet. Everything is described in the library readme. Regarding the "downloads the zip", the zip clearly states that it contains the source code of the library.

Is Popper js a bootstrap dependency?

Bootstrap has dependency on Jquery and Popper js.


2 Answers

Bootstrap 4 has two dependencies: jQuery 1.9.1 and popper.js 1.12.3. When you install Bootstrap 4, you need to install these two dependencies.

For Bootstrap 4.1

like image 53
Jobayer Ahmmed Avatar answered Oct 23 '22 13:10

Jobayer Ahmmed


https://cdnjs.com/libraries/popper.js does not look like a right src for popper, it does not specify the file

with bootstrap 4 I am using this

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> 

and it is working perfectly fine, give it a try

like image 23
Sam Hajari Avatar answered Oct 23 '22 12:10

Sam Hajari