简体   繁体   English

尽管在 Angular 中使用时,引导程序需要 popper.js

[英]Bootstrap requires popper.js despite bundle when used in Angular

I installed bootstrap@next ( v5.0.0-alpha1 ) through npm .我通过npm安装了bootstrap@next ( v5.0.0-alpha1 )。 i added the bundle JS to the scripts, but after compiling I receive this error:我将捆绑JS添加到脚本中,但编译后收到此错误:

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. ).我们提供编译后的 CSS 和 JS (bootstrap. ),以及编译和缩小的 CSS 和 JS (bootstrap.min. )。 source maps (bootstrap.*.map) are available for use with certain browsers' developer tools.源映射 (bootstrap.*.map) 可用于某些浏览器的开发工具。 Bundled JS files (bootstrap.bundle.js and minified bootstrap.bundle.min.js) include Popper.捆绑的 JS 文件(bootstrap.bundle.js 和缩小的 bootstrap.bundle.min.js)包括 Popper。

angular.json 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.只需在 package.json 中列出 popper 就足够了。 I had the same issue and upon deleting "node_modules/bootstrap/dist/js/bootstrap.bundle.js" it has worked for me.我遇到了同样的问题,删除“node_modules/bootstrap/dist/js/bootstrap.bundle.js”后它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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