简体   繁体   中英

Bootstrap requires popper.js despite bundle when used in Angular

I installed bootstrap@next ( v5.0.0-alpha1 ) through npm . i added the bundle JS to the scripts, but after compiling I receive this error:

ERROR in ./node_modules/bootstrap/dist/js/bootstrap.esm.js
Module not found: Error: Can't resolve 'popper.js' in
'./foo/node_modules/bootstrap/dist/js'

The README clearly states ( bold text ):

We provide compiled CSS and JS (bootstrap. ), as well as compiled and minified CSS and JS (bootstrap.min. ). source maps (bootstrap.*.map) are available for use with certain browsers' developer tools. Bundled JS files (bootstrap.bundle.js and minified bootstrap.bundle.min.js) include Popper.

angular.json

"scripts": [
    "node_modules/bootstrap/dist/js/bootstrap.bundle.js",
],

Any idea what I could miss here?

It should be enough for the popper to be just listed in package.json. I had the same issue and upon deleting "node_modules/bootstrap/dist/js/bootstrap.bundle.js" it has worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM