在使用 grunt (grunt serve) 时,我得到:
Running "bower-install:app" (bower-install) task
popcornjs was not injected in your file.
Please go take a look in "app\bower_components\popcornjs" for the file you need, then manually include it in your file.
我已将 Popcorn.js 添加到 bower.json:
{
"name": "NAME",
"version": "0.0.0",
"dependencies": {
"angular": "1.2.6",
.
"popcornjs": "~1.3.0",
.
"angular-slugify": "1.0.0"
},
"devDependencies": {
"angular-mocks": "1.2.6",
"angular-scenario": "1.2.6"
}
}
至于我的index.html:
<s_cript src="bower_components/popcornjs/popcorn.js"></script>
<s_cript src="bower_components/popcornjs/modules/player/popcorn.player.js"></script>
<s_cript src="bower_components/popcornjs/players/youtube/popcorn.youtube.js"></script>
<s_cript src="bower_components/popcornjs/plugins/code/popcorn.code.js"></script>
.'.'
我是不是漏掉了什么?其他图书馆工作正常。
最佳答案
我刚刚对 popcornjs
进行了快速搜索。当你说 bower install --save popcornjs
时,你从中提取的 repo 是 https://github.com/mozilla/popcorn-js/ .该 repo 有一个 bower.json
文件,该文件中有一个 main
属性。该属性告诉 grunt-bower-install
要在 HTML 中注入(inject)什么文件。
但是,您使用的是 ~1.3.0
版本,这会降低以下内容:https://github.com/mozilla/popcorn-js/tree/v1.3.0 .它没有 bower.json
,因此 grunt-bower-install
无法知道要包含什么文件。
解决方案是手动将其包含在您的 HTML 中,或升级到正确使用 Bower 的较新版本。
关于javascript - 爆米花未注入(inject)您的文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21840776/