How to install popper.js with Bootstrap 4?

后端 未结 11 770
眼角桃花
眼角桃花 2020-12-07 17:17

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 r

相关标签:
11条回答
  • 2020-12-07 17:53

    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

    0 讨论(0)
  • 2020-12-07 17:55

    I have the same problem while learning Node.js Here is my solution for it to install jquery

    npm install jquery@1.9.1 --save
    npm install popper.js@^1.12.9 --save
    
    0 讨论(0)
  • 2020-12-07 17:58

    Pawel and Jobayer has already mentioned about how to install popper.js through npm.

    If you are using front-end package manager like bower. use the following command

    bower install popper.js --save
    
    0 讨论(0)
  • 2020-12-07 18:01

    I had problems installing it Bootstrap as well, so I did:

    Install popper.js: npm install popper.js@^1.12.3 --save

    Install jQuery: npm install jquery@1.9.1 --save

    Then I had a high severity vulnerability message when installing jquery@1.9.1 and got this message:

    run npm audit fix to fix them, or npm audit for details

    So I did npm audit fix, and after another npm audit fix --force it successfully installed!

    0 讨论(0)
  • 2020-12-07 18:02

    Here is a work-around:

    1. Create a js directory in the same directory as your index.html
    2. Download popper.min.js from the following site into said js directory https://github.com/FezVrasta/popper.js#installation

    e.g.: https://unpkg.com/popper.js/dist/umd/popper.min.js

    1. Change your the src of your script include to look like this:

      src="js/popper.min.js"

    Note that you've removed Popper from npm version control, so you'll have to manually download updates.

    0 讨论(0)
  • 2020-12-07 18:03

    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.

    • Install popper.js: npm install popper.js@^1.12.3 --save
    • Install jQuery: npm install jquery@1.9.1 --save
    • Install Bootstrap: npm install bootstrap@4.0.0-beta.2 --save

    For Bootstrap 4.1

    • npm install popper.js@^1.14.3 --save
    • npm install jquery@3.3.1 --save
    • npm install bootstrap@4.1.1 --save
    0 讨论(0)
提交回复
热议问题