【问题标题】:Foundation5 causing error on grunt/bower buildFoundation5 在 grunt/bower 构建时导致错误
【发布时间】:2014-05-15 00:41:21
【问题描述】:

在使用 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:

我可以在那里选择一个版本,它似乎工作。但我需要它在构建脚本中工作。

【问题讨论】:

    标签: gruntjs zurb-foundation bower bower-install


    【解决方案1】:

    尝试将 jQuery 更改为:

    "jquery": "~1.11.0"
    

    编辑

    根据 Foundation 的 bower.json,它声明它需要 jQuery >= 2.1

    {
      "name": "foundation",
      "version": "5.2.2",
      "main": [
        "css/foundation.css",
        "js/foundation.js"
      ],
      "dependencies": {
        "jquery": ">= 2.1.0",
        "modernizr": ">= 2.7.2",
        "fastclick": ">=0.6.11",
        "jquery.cookie": "~1.4.0",
        "jquery-placeholder": "~2.0.7"
      },
      "devDependencies": {
        "jquery.autocomplete": "devbridge/jQuery-Autocomplete#1.2.9",
        "lodash": "~2.4.1"
      },
      "private": true
    }
    

    那么 2 版本之间存在冲突。你改了吗?

    【讨论】:

      猜你喜欢
      • 2015-05-11
      • 1970-01-01
      • 2016-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-20
      • 2011-09-14
      相关资源
      最近更新 更多