Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
842 views
in Technique[技术] by (71.8m points)

angularjs - why doesn't bower update angular upgrade my angular?

I have angular 1.2.3 and I want to upgrade to 1.2.7

> cat bower.json
...
  "dependencies": {
    "json3": "~3.2.4",
    "jquery": "~1.9.1",
    "es5-shim": "~2.0.8",
    "toastr": "~2.0.1",
    "angular-ui-tinymce": "latest",
    "underscore": "~1.5.2",
    "underscore.string": "~2.3.3",
    "angular-ui-utils": "~0.0.4",
    "angular-dragdrop": "~1.0.5",
    "angular-cookies": "~1.2.3",
    "angular-animate": "~1.2.3",
    "angular-resource": "~1.2.3",
    "angular": "~1.2.3"
  },
  "devDependencies": {
    "angular-mocks": "~1.2.3",
    "bootstrap": "~3.0.1",
    "font-awesome": "~4.0.3",
    "angular-bootstrap-affix": "~0.3.0"
  }
...

I don't know what the following output even means...., what is it doing?

> bower update angular
bower angular#~1.x              cached git://github.com/angular/bower-angular.git#1.2.7
bower angular#~1.x            validate 1.2.7 against git://github.com/angular/bower-angular.git#~1.x
bower angular#>= 1.0.2          cached git://github.com/angular/bower-angular.git#1.2.7
bower angular#>= 1.0.2        validate 1.2.7 against git://github.com/angular/bower-angular.git#>= 1.0.2
bower angular#1.2.3             cached git://github.com/angular/bower-angular.git#1.2.3
bower angular#1.2.3           validate 1.2.3 against git://github.com/angular/bower-angular.git#1.2.3
bower angular#~1.2.3            cached git://github.com/angular/bower-angular.git#1.2.7
bower angular#~1.2.3          validate 1.2.7 against git://github.com/angular/bower-angular.git#~1.2.3
bower angular#~1.x                 new version for git://github.com/angular/bower-angular.git#~1.x
bower angular#~1.x             resolve git://github.com/angular/bower-angular.git#~1.x
bower angular#>= 1.0.2             new version for git://github.com/angular/bower-angular.git#>= 1.0.2
bower angular#>= 1.0.2         resolve git://github.com/angular/bower-angular.git#>= 1.0.2
bower angular#~1.2.3               new version for git://github.com/angular/bower-angular.git#~1.2.3
bower angular#~1.2.3           resolve git://github.com/angular/bower-angular.git#~1.2.3
bower angular#~1.x            download https://github.com/angular/bower-angular/archive/v1.2.8-build.2095+sha.28fc80b.tar.gz
bower angular#>= 1.0.2        download https://github.com/angular/bower-angular/archive/v1.2.8-build.2095+sha.28fc80b.tar.gz
bower angular#~1.2.3          download https://github.com/angular/bower-angular/archive/v1.2.8-build.2095+sha.28fc80b.tar.gz
bower angular#>= 1.0.2         extract archive.tar.gz
bower angular#>= 1.0.2        resolved git://github.com/angular/bower-angular.git#1.2.8-build.2095+sha.28fc80b
bower angular#~1.x             extract archive.tar.gz
bower angular#~1.x            resolved git://github.com/angular/bower-angular.git#1.2.8-build.2095+sha.28fc80b
bower angular#~1.2.3           extract archive.tar.gz
bower angular#~1.2.3          resolved git://github.com/angular/bower-angular.git#1.2.8-build.2095+sha.28fc80b

nothing changed? I'm still on 1.2.3

> git diff
diff --git a/ngapp/app/bower_components/angular/.bower.json b/ngapp/app/bower_components/angular/.bower.json
index dc9d0b6..842a1f3 100644
--- a/ngapp/app/bower_components/angular/.bower.json
+++ b/ngapp/app/bower_components/angular/.bower.json
@@ -11,6 +11,6 @@
     "commit": "b112b099971f4cf016023bdeb00b267e9bf6dfb5"
   },
   "_source": "git://github.com/angular/bower-angular.git",
-  "_target": "~1.2.3",
+  "_target": "1.2.3",
   "_originalSource": "angular"
 }

> bower --version
1.2.8

Am I missing something?

> bower info angular
.... shows all versions including 1.2.7 and 1.2.8-builds as well
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think your dependencies are preventing you from updating angular in isolation. E.g., look at bower_components/angular-route/bower.json. You will see a specific version of angular listed as a dependency ("1.2.3") and not a ~/"reasonably close" specifier" ("~1.2.3"). So you are trying to update just angular, but the farthest that bower can take your angular is the current version since you have other packages that depend on exactly that version.

If you do bower update then bower will have the opportunity to update all your packages, including angular-route and other packages that are holding angular back. The updates to these packages will now allow bower to update angular while satisfying dependencies. Also, I think if you identified all those packages depending on a specific angular version (you can see dependencies with bower list) and passed them as arguments like bower update angular angular-mocks angular-resource angular-route angular-sanitize... then bower could also perform the update.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...