【发布时间】:2014-02-18 18:50:07
【问题描述】:
这快把我逼疯了。到目前为止,Bower+Grunt(通过 Yeoman)一直是挫败感和浪费时间的主要来源。我只想让我的应用使用最新 (2.1.0) 版本的 jquery。
bower list 正确地将 jquery 2.1.0 报告为官方更新。
我运行bower install --save jquery 更新到最新版本,它确实做到了。
bower list 命令现在可以正确地将jquery#2.1.0 报告为依赖项,并且
bower.json 文件现在可以正确列出带有所需版本的 jquery 作为依赖项:
{
"name": "xxx",
"version": "0.0.0",
"dependencies": {
...
"angular": "1.2.13",
"jquery": "~2.1.0",
"sizzle": "1.10.16",
"bootstrap": "~3.0.3",
...
但每次我运行 grunt build 或 grunt serve 时,<script src="bower_components/jquery/dist/jquery.js"></script> 列表都会从 index.html 中删除,从而阻止整个应用程序运行。
#> grunt serve
Running "serve" task
Running "clean:server" (clean) task
Cleaning .tmp...OK
Running "bower-install:app" (bower-install) task
jquery was not injected in your file.
Please go take a look in "app/bower_components/jquery" for the file you need, then manually include it in your file.
Running "concurrent:server" (concurrent) task
...
手动添加并不能解决任何问题。我完全被困住了。一定有什么我做错了,但我一直在敲我的头很长一段时间,而完全没有生产力。谢谢。
【问题讨论】: