bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js

后端 未结 12 1939
春和景丽
春和景丽 2020-12-04 18:41

Suddenly I started to get error when I try to open my dropdown menu :

 bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js (https://poppe         


        
相关标签:
12条回答
  • 2020-12-04 19:22

    I had this issue with an MVC project and here is how I fixed it.

    1. Open BundleConfig.cs
    2. Find :

      bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.js"));

      Change to:

      bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.bundle.min.js"));
      

    This will set the bundle file to load. It is already in the correct order. You just have to make sure that you are rendering this bundle in your view.

    0 讨论(0)
  • 2020-12-04 19:24

    Use

    /js/bootstrap.bundle.min.js
    

    instead of

    /js/bootstrap.min.js
    
    0 讨论(0)
  • 2020-12-04 19:25

    I was facing this issue, then I put my dropdown in nav tag. Worked for me that way.

    0 讨论(0)
  • 2020-12-04 19:26

    As pointed out here you must use the script in the UMD subdirectory, in my case

            bundles.Add(new ScriptBundle("~/bundles/projectbundle").Include(
                "~/Scripts/umd/popper.js",
                "~/Scripts/bootstrap.js",
                "~/Scripts/respond.js",
                "~/Scripts/summernote-bs4.js"));
    

    Specifically this: "~/Scripts/umd/popper.js",

    0 讨论(0)
  • 2020-12-04 19:27

    On moving a .html template to a wordpress one, I found this "popper required" popping up regularly :)

    Two reasons it happened for me: and the console error can be deceptive:

    1. The error in the console can send you down the wrong path. It MIGHT not be the real issue. First reason for me was the order in which you have set your .js files to load. In html easy, put them in the same order as the theme template. In Wordpress, you need to enqueue them in the right order, but also set a priority if they don't appear in the right order,

    2. Second thing is are the .js files in the header or the footer. Moving them to the footer can solve the issue - it did for me, after a day of trying to debug the issue. Usually doesn't matter, but for a complex page with lots of js libraries, it might!

    0 讨论(0)
  • 2020-12-04 19:27

    I had the same error and just wanted to share my solution. In turned out that the minified version of popper had the code in the same line as the comment and so the entire code was commented out. I just pressed enter after the actual comment so the code was on a new line and then it worked fine.

    0 讨论(0)
提交回复
热议问题