在bower.json中有这个

{
    "name": "test",
    "dependencies": {
        "jquery": "2.2.4",
        "html5shiv": "3.6.2"
    }
}

并运行

凉亭安装

Bower不是安装此版本,而是安装最新版本(到目前为止,jquery 3.0.0-rc1和html5shiv 3.7.3)。为什么这样?我没有其他可能需要最新版本的依赖项。

这是凉亭安装日志

Bower缓存https://github.com/jquery/jquery-dist.git#2.2.4
Bower针对https://github.com/jquery/jquery-dist.git#2.2.4验证2.2.4
Bower缓存了https://github.com/aFarkas/html5shiv.git#3.6.2
Bower针对https://github.com/aFarkas/html5shiv.git#3.6.2验证3.6.2
Bower安装jquery#2.2.4
凉亭安装html5shiv#3.6.2
jquery#2.2.4 bower_components \ jquery
html5shiv#3.6.2 bower_components \ html5shiv

对我来说很奇怪的是html5shiv的.bower.json看起来像这样
{
  "name": "html5shiv",
  "version": "3.6.2",
  "main": [
    "dist/html5shiv.js"
  ],
  "ignore": [
    "**/.*",
    "composer.json",
    "test",
    "build",
    "src",
    "build.xml"
  ],
  "homepage": "https://github.com/aFarkas/html5shiv",
  "_release": "3.6.2",
  "_resolution": {
    "type": "version",
    "tag": "3.6.2",
    "commit": "f65f9b0d776ae3b88d4c7f0b27c64e384aee47aa"
  },
  "_source": "https://github.com/aFarkas/html5shiv.git",
  "_target": "3.6.2",
  "_originalSource": "html5shiv"
}

但是bower.json看起来像这样
{
  "name": "html5shiv",
  "version": "3.7.3",
  "main": [
    "dist/html5shiv.js"
  ],
  "ignore": [
    "**/.*",
    "composer.json",
    "test",
    "build",
    "src",
    "build.xml"
  ]
}

jQuery也是如此。 .bower.json引用了我想要的版本,但是bower.json引用了最新版本。就像我说的那样,源文件和dist文件来自最新版本。

最佳答案

您应该在版本之前使用#
例如

{
    "name": "test",
    "dependencies": {
        "jquery": "#2.2.4"
    }
}

你可以找到more about bower here

关于bower - 为什么Bower安装最新版本的软件包而不是我想要的确切版本?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37479383/

10-11 22:09
查看更多