首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法将引导程序4、jQuery和PopperJS库添加到.ange-cli.json

无法将引导程序4、jQuery和PopperJS库添加到.ange-cli.json
EN

Stack Overflow用户
提问于 2018-02-06 01:05:45
回答 1查看 608关注 0票数 0

目前,我正试图在我的角5项目上实现 navbar元素,它需要三个JS库: Bootstrap 4、jQuery和PopperJS。

它完美无缺地工作在(即没有错误发生)添加到src/index.html中时

代码语言:javascript
复制
<head>
...
...
...
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>

然而, I想做一个实验,将那些三个JS库添加到.angular-cli.json中(而不是在src/index.html上使用CDN ),所以我做了以下工作:

.angular-cli.json上,我添加:

代码语言:javascript
复制
"scripts": [
        "../node_modules/jquery/dist/jquery.slim.min.js",
        "../node_modules/popper.js/dist/popper.js",
        "../node_modules/bootstrap/dist/js/bootstrap.min.js"        
      ],

注意:在将这三个脚本添加到.angular-cli.json之前,我已经使用npm安装了Bootstrap 4、jQuery和PopperJS包。

运行它时,控制台上有一个错误(Chrome工具)

代码语言:javascript
复制
Uncaught SyntaxError: Unexpected token export         scripts.bundle.js:2302

单击它带来的错误消息时

代码语言:javascript
复制
export default Popper;

我有点搞不懂到底发生了什么,问题的真正原因是什么?如何修复此错误?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-02 10:40:50

  1. npm install --save bootstrap jquery popper.js
  2. 角-cli.json: “样式”:"../node_modules/bootstrap/dist/css/bootstrap.min.css","styles.css“,”脚本“:”./node_node/jquery/dist/jquery.min.js“,"../node_modules/popper.js/dist/umd/popper.js","../node_modules/bootstrap/dist/js/bootstrap.min.js”,

现在你可以启动你的应用程序了

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48633945

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档