【问题标题】:bower: install jquery 1x along with 2x [duplicate]bower:安装 jquery 1x 和 2x [重复]
【发布时间】:2014-06-19 15:43:13
【问题描述】:

我有 jquery ver 2 是通过 bower 安装的。现在尝试获取最新的 1.x (1.11.1)。但是,它没有提供该选项

bower install jquery --save
bower jquery#*                  cached git://github.com/jquery/jquery.git#2.1.0
bower jquery#*                validate 2.1.0 against git://github.com/jquery/jquery.git#*
bower jquery#*                     new version for git://github.com/jquery/jquery.git#*
bower jquery#*                 resolve git://github.com/jquery/jquery.git#*
bower jquery#*                download https://github.com/jquery/jquery/archive/2.1.1.tar.gz
bower jquery#*                 extract archive.tar.gz
bower jquery#*                resolved git://github.com/jquery/jquery.git#2.1.1
bower jquery#>=1.8.0            cached git://github.com/jquery/jquery.git#2.1.1
bower jquery#>=1.8.0          validate 2.1.1 against git://github.com/jquery/jquery.git#>=1.8.0

Unable to find a suitable version for jquery, please choose one:
    1) jquery#1.8.3 which resolved to 1.8.3 and is required by angular-file-upload#0.3.1 
    2) jquery#>=1.8.0 which resolved to 2.1.1 and is required by angular-gettext#0.2.8 
    3) jquery#~2.1.1 which resolved to 2.1.1

Prefix the choice with ! to persist it to bower.json

[?] Answer: 

我的 bower.json 的一部分看起来像

{

  "dependencies": {
    "angular-bootstrap": "~0.10.0",
    "angular-file-upload": "~0.3.1",
    ....
  },
  "devDependencies": {
    "jquery2": "jquery#2",
    "sinon-chai": "~2.5.0",
    "sinon": "~1.9.1"
  }
}

【问题讨论】:

  • 这是用于生产代码吗?您真的应该在生产代码中包含“最新版本的 jquery”。最好将其设置为特定版本以避免出现问题。
  • 感谢您指出。 jquery 仅用于测试。我承认,我没有拆分依赖项并很好地指定依赖项。但至少在开发过程中,我喜欢跟上最新版本,直到我准备好发布。
  • 希望我没有打错那个评论,哈哈。那应该是“不应该”。 :)

标签: jquery bower


【解决方案1】:

this answer怎么样:

bower install jquery-legacy=jquery#^1 jquery-modern=jquery

【讨论】:

    猜你喜欢
    • 2018-12-28
    • 1970-01-01
    • 2013-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多