【发布时间】:2016-09-29 05:00:03
【问题描述】:
我正在尝试使用 npm 安装引导程序。我跑了:
npm install angular-ui-bootstrap
并且成功地将模块安装在node_modules 文件夹中。问题是我似乎无法引用 index.html 中的文件。我输入以下行:
<script src="/node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>
但它返回 404。我有 3 个问题:
- 我是否引用了正确的文件
- 如何将文件包含在 index.html 中
-
如果我在 html 中包含该文件,是否足以消除我遇到的另一个错误:
Error: [$injector:modulerr] Failed to instantiate module ui.bootstrap due to: Error: [$injector:nomod] Module 'ui.bootstrap' is not available!
这是文件结构:
Project
-app
-index.html
-node_modules
-angular-ui-bootstrap
-dist
-ui-bootstrap.js
【问题讨论】:
-
你能提供
node_modules/附近的文件结构吗? -
是的,我刚刚添加了它。
-
尝试将
../添加到您的参考文献的开头。您需要移出app/目录。 -
使用
<script src="../node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script> -
@Aeolingamenfel 谢谢,这就是我的想法,但它不起作用。我得到完全相同的错误
标签: angularjs npm angular-bootstrap