【问题标题】:ECONFLICT Unable to find suitable version for jquery FoundationECONFLICT 无法为 jquery Foundation 找到合适的版本
【发布时间】:2015-02-12 04:13:25
【问题描述】:

我正在尝试安装 Foundation,但它不断让我与 Jquery 发生冲突

λ bower install foundation
bower foundation#x              cached https://github.com/zurb/bower-foundation.git#5.5.1
bower foundation#x            validate 5.5.1 against https://github.com/zurb/bower-foundation.git#x
bower foundation#*              cached https://github.com/zurb/bower-foundation.git#5.5.1
bower foundation#*            validate 5.5.1 against https://github.com/zurb/bower-foundation.git#*
bower jquery#>= 2.1.0           cached https://github.com/jquery/jquery.git#2.1.3
bower jquery#>= 2.1.0         validate 2.1.3 against https://github.com/jquery/jquery.git#>= 2.1.0
bower modernizr#>= 2.7.2        cached https://github.com/Modernizr/Modernizr.git#2.8.3
bower modernizr#>= 2.7.2      validate 2.8.3 against https://github.com/Modernizr/Modernizr.git#>= 2.7.2
bower jquery.cookie#~1.4.0      cached https://github.com/carhartl/jquery-cookie.git#1.4.1
bower jquery.cookie#~1.4.0    validate 1.4.1 against https://github.com/carhartl/jquery-cookie.git#~1.4.0
bower fastclick#>=0.6.11        cached https://github.com/ftlabs/fastclick.git#1.0.6
bower fastclick#>=0.6.11      validate 1.0.6 against https://github.com/ftlabs/fastclick.git#>=0.6.11
bower jquery-placeholder#~2.0.7 cached https://github.com/mathiasbynens/jquery-placeholder.git#2.0.9
bower jquery-placeholder#~2.0.7         validate 2.0.9 against https://github.com/mathiasbynens/jquery-placeholder.git#~2.0.7
bower                                  ECONFLICT Unable to find suitable version for jquery

我的 bower.json 文件是这个

{
  "name": "refactor",
  "private": true,
  "dependencies": {
    "jquery": "~1.11.1",
    "raphael": "1.3.x",
    "font-awesome": "~4.3.0",
    "foundation": "x"
  }
}

【问题讨论】:

  • 使用“jquery”:">= 2.0.0"
  • 我刚刚删除了 JQuery。现在它来自基金会,我不知道它的正确做法是否正确
  • 在下面查看我的答案,让我知道它是否有效。谢谢

标签: javascript jquery json zurb-foundation bower


【解决方案1】:

在您的bower.json 中使用resolutions

{
  "name": "refactor",
  "private": true,
  "dependencies": {
    "jquery": "~1.11.1",
    "raphael": "1.3.x",
    "font-awesome": "~4.3.0",
    "foundation": "x"
  },
  "resolutions": {
    "jquery": "~1.11.1"
  }
}

这将强制 bower 使用特定版本的 jQuery。

【讨论】:

  • 太棒了!非常感谢!
  • 这对我有用!我从 npm 调试日志中得到的错误消息(在控制台中有点神秘)表明需要什么版本的 jQuery。这是在为 Drupal 8 站点配置 vagrant 时。非常感谢!
【解决方案2】:

最好的开始是做

bower cache clean

当你这样做之后

bower install它会问你

'Unable to find a suitable version for <Your Dependency Name>, please choose one:,

然后你可以输入!1!2 ,或最适合您需要的任何内容。

正如@esbanarango 所提到的,这基本上将分辨率块添加到bower.json 中,但它只是让您更好地控制和理解您正在做的事情。

【讨论】:

    【解决方案3】:

    尝试在 Jquery 版本中使用它:

    "jquery": ">= 2.0.0"
    

    但是我认为您只需要 Foundation 作为依赖项:

    或:

    {
        "name": "PROJECT_NAME",
        "dependencies": {
           "foundation": "~5.4.7"
        }
    } 
    

    也可以在这里查看更多详细信息:

    http://foundation.zurb.com/docs/sass.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-23
      • 2016-11-19
      • 1970-01-01
      • 2017-07-25
      • 1970-01-01
      • 2016-06-21
      • 2015-03-27
      相关资源
      最近更新 更多