Raffaeu Raffaeu - 4 months ago 53
JSON Question

Update to latest Polymer using Bower

I have a Polymer application which is configured as following:

My main project bower.json file:

{
"name": "Raf",
"authors": [
"Raffaeu <raffaeu@gmail.com>"
],
"description": "Test Project",
"dependencies": {
"polymer": "Polymer/polymer#1.2.0",
"iron-elements": "PolymerElements/iron-elements#^1.0.8",
"paper-elements": "PolymerElements/paper-elements#^1.0.7"
}
}


and inside my bower_components folder I do have a polymer folder with the following JSON:

{
"name": "polymer",
"version": "1.2.0",
"main": [
"polymer.html"
],
"repository": {
"type": "git",
"url": "https://github.com/Polymer/polymer.git"
},
"dependencies": {
"webcomponentsjs": "^0.7.2"
}
}


Now, if I am in the root folder (where the main bower.json file is located) and I am running
bower info polymer
bower returns me the following list of versions:

bower cached https://github.com/Polymer/polymer.git#1.6.0
bower validate 1.6.0 against https://github.com/Polymer/polymer.git#*

{
name: 'polymer',
version: '1.6.0',
...


But if I run
bower update polymer --save
console returns following message and doesn't update to 1.6.0 but it stays to my current version which is 1.2.0:
Unable to find a suitable version for polymer, please choose one by typing one of the numbers below:

1) polymer#1.2.0 which resolved to 1.2.0 and is required by MyTestProject
2) polymer#~1.2.0 which resolved to 1.2.4 and is required by paper-datatable#0.9.8
3) polymer#^1.2.0 which resolved to 1.6.0 and is required by iron-behaviors#1.0.13
4) polymer#^1.2.1 which resolved to 1.6.0 and is required by paper-behaviors#1.0.11
5) polymer#^1.2.4 which resolved to 1.6.0 and is required by iron-menu-behavior#1.1.3
6) polymer#^1.1.1 which resolved to 1.6.0 and is required by vaadin-grid#1.0.0
7) polymer#^1.0.0 which resolved to 1.6.0 and is required by iron-a11y-keys-behavior#1.1.1
8) polymer#^1.1.0 which resolved to 1.6.0 and is required by paper-dropdown-menu#1.1.3

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

? Answer 1


And nothing is updated.
Should I manually change version to 1.6.0 inside the polymer folder then run update?

Answer

you need to select !3 this will add a new object in your bower.json called resolutions with value as polymer#^1.2.0. Using ! will persist your choice in bower.json. As you are selecting first option it is taking the version from your bower.json which is set to use exact version i.e. 1.2.0.

Actually, you can select anything after 3rd option as they all are latest above mentioned version because of '^'.