爆米花没有注入你的档案

时间:2014-02-17 22:43:43

标签: javascript angularjs yeoman bower popcornjs

在进行grunt(咕噜声)时,我得到了:

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>

。 ''

我错过了什么吗?其他图书馆工作正常。

1 个答案:

答案 0 :(得分:7)

我刚刚对popcornjs进行了快速搜索。当您说bower install --save popcornjs时,您撤回的回购邮件是https://github.com/mozilla/popcorn-js/。该repo有一个bower.json文件,该文件中包含main属性。该属性告诉grunt-bower-install要在HTML中注入的文件。

但是,您使用的是版本~1.3.0,这会将其下拉:https://github.com/mozilla/popcorn-js/tree/v1.3.0。它没有bower.json,因此grunt-bower-install无法知道要包含哪个文件。

解决方案是手动将其包含在HTML中,或升级到正确使用Bower的较新版本。