简体   繁体   中英

How can I specify just to install one thing with bower?

Given the following:

{
  "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"
  }
}

Then how can I ask bower to just install user_staging1 ?

Also can someone tell me what is the purpose of the resolutions area?

When you want to install just one package, you use bower install package_name (you can add --save parameter if you want to save this dependency to your own bower.json file).

Resolutions area helps resolve dependency version conflicts. For example, if angular-ui-router depends on angular version 1.4.0 while angular-loading-bar depends on angular version 1.3.0 when you run bower install you will get a message like the following:

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

and you will have to choose either 1 or 2. In order to persist this choice and prevent bower from asking you all the time the above question, you can add your choice to resolutions area.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM