如何指定只用凉亭安装一件东西?

时间:2015-05-09 06:14:14

标签: javascript bower bower-install

鉴于以下内容:

{
  "name": "user_staging1",
  "private": true,
  "dependencies": {
    "angular": "^1.4.0",
    "angular-ui-router": "^0.2.0",
    "angular-loading-bar": "^0.6.0"
  },
  "resolutions": {
    "angular": "^1.4.0"
  }
}

{
  "name": "user_staging2",
  "private": true,
  "dependencies": {
    "angular": "^1.4.0",
    "angular-ui-router": "^0.2.0",
    "angular-loading-bar": "^0.6.0"
  },
  "resolutions": {
    "angular": "^1.4.0"
  }
}

然后我怎样才能让bower只安装user_staging1?

也有人能告诉我决议区的目的是什么?

1 个答案:

答案 0 :(得分:0)

如果只想安装一个软件包,可以使用bower install package_name(如果要将此依赖项保存到自己的--save文件中,可以添加bower.json参数。

Resolutions区域有助于解决依赖项版本冲突。例如,angular-ui-router取决于angular version 1.4.0angular-loading-bar取决于angular version 1.3.0,当您运行bower install时,您将收到如下消息:

Unable to find a suitable version for angular, please choose one:
1) angular 1.3.0 which is required by angular-loading-bar
2) angular 1.4.0 which is required by angular-ui-router

你必须选择1或2.为了坚持这个选择并防止凉亭一直问你上述问题,你可以将你的选择添加到决议区。