为什么没有更新角度升级角度?

时间:2014-01-09 19:44:32

标签: angularjs bower

我有角度1.2.3,我想升级到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"
  }
...

我不知道以下输出甚至意味着什么......,它在做什么?

> 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
没有改变?我还在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

我错过了什么吗?

> bower info angular
.... shows all versions including 1.2.7 and 1.2.8-builds as well

2 个答案:

答案 0 :(得分:17)

我认为你的依赖关系会阻止你单独更新角度。例如,看看bower_components/angular-route/bower.json。您将看到特定版本的角度列为依赖关系(" 1.2.3")而不是~ /"合理关闭"符" ("〜1.2.3&#34)。所以你试图只更新角度,但最大的凉亭可以采取你的角度是当前版本,因为你有其他软件包完全依赖于该版本。

如果你bower update,那么凉亭将有机会更新你的所有包裹,包括角度路线和其他保持角度的包裹。对这些软件包的更新现在允许bower在满足依赖性的同时更新角度。另外,我认为如果您根据特定的角度版本识别出所有这些包(您可以看到bower list的依赖关系)并将它们作为bower update angular angular-mocks angular-resource angular-route angular-sanitize...之类的参数传递,那么bower也可以执行更新。

答案 1 :(得分:7)

我认为问题在于此

"angular": "~1.2.3" 

https://github.com/isaacs/node-semver/

"Reasonably close to 1.2.3". 

因此您应该使用

进行更改
"angular": "1.2.7" 

<强>更新 (它在评论中,但我认为最好指出来)

请注意,您无法将程序包名称传递给update命令,只能更新该程序包:它仍然会更新所有程序包。您可以通过运行bower install来获取单个软件包的最新版本;它只会覆盖您当前拥有的版本