在使用 Grunt 和 bower 构建我的项目时,Foundation 似乎导致了错误。您可以看到它正在下载软件包等,然后退出:
致命错误:无法找到适合 jquery 的版本
这是我的 bower.json:
{
"name": "MyProject",
"version": "1",
"dependencies": {
"cytoscape": "2.2.7",
"datatables": "1.9.4",
"font-awesome": "4.0.3",
"foundation": "5.2.2",
"jquery-legacy": "jquery#1.11.0",
"kineticjs": "5.1.0",
"nouislider": "6.2.0",
"rem-unit-polyfill": "1.2.4",
"respond": ">=1.4.2"
}
}
我已经尝试从上面的 bower.json 中删除每个依赖项,每次都重新运行我的 grunt 文件(其中包括用于安装 bower 的触发器)。在删除 Foundation 行之前,我会收到该错误 - 然后一切正常(好吧,直到 Grunt 查找基础文件)。
我查看了 Foundation 的 bower.json 及其依赖项,但“似乎”没有任何问题。
我试图为我的 bower.json 添加一个分辨率:
...,
"resolutions": {
"jquery": "1.11.0"
}
}
但这没有帮助。(虽然我可能使用不正确?)
如果我bower install
直接从命令行尝试,我会得到:
> Unable to find a suitable version for jquery, please choose one:
> 1) jquery#~1.8.0 which resolved to 1.8.3+1 and has datatables#1.9.4 as dependants
> 2) jquery#>= 2.1.0 which resolved to 2.1.1 and has foundation#5.2.2 as dependants
> 3) jquery#>=1.2 which resolved to 2.1.1 and has jquery.cookie#1.4.1 as dependants
> 4) jquery#>= 1.7.0 which resolved to 2.1.1 and has nouislider#6.2.0 as dependants
>
> Prefix the choice with ! to persist it to bower.json
>
> [?] Answer:
我可以在那里选择一个版本,它似乎工作。但我需要这个在构建脚本中工作。