我正在尝试安装软件包,例如bower install restangular --save
然后Bower要我选择一个Angular版本:
> Unable to find a suitable version for angular, please choose one:
> 1) angular#1.2.6 which resolved to 1.2.6 and has ang-changeorg, angular-cookies#1.2.6, angular-mocks#1.2.6, angular-resource#1.2.6,
> angular-sanitize#1.2.6, angular-scenario#1.2.6 as dependants
> 2) angular#1.2.17-build.226+sha.b6388b3 which resolved to 1.2.17-build.226+sha.b6388b3 and has angular-animate#1.2.17-build.226+sha.b6388b3 as dependants
> 3) angular#* which resolved to 1.2.18 and has restangular#1.4.0 as dependants
> 4) angular#~1.2.0 which resolved to 1.2.19-build.258+sha.ea653e4 and has angularfire#0.7.1 as dependants
> 5) angular#>= 1.0.8 which resolved to 1.3.0-build.2845+sha.e57ad6a and has angular-ui-router#0.2.10 as dependants
>
> Prefix the choice with ! to persist it to bower.json
在这些选项中,ang-changeorg
是我在本地工作的另一个项目,与我当前的工作目录无关。
我当前项目的bower.json
如下:
{
"name": "ang-changeorg",
"version": "0.0.0",
"appPath": "public",
"dependencies": {
"angular": "1.2.6",
"json3": "~3.2.6",
"es5-shim": "~2.1.0",
"jquery": "~1.10.2",
"bootstrap": "~3.0.3",
"angular-resource": "1.2.6",
"angular-cookies": "1.2.6",
"angular-sanitize": "1.2.6",
"firebase": "~1.0.11",
"angularfire": "~0.7.1",
"spin.js": "~2.0.0",
"angular-ui-router": "~0.2.10",
"angular-animate": "~1.2.16",
"ng-file-upload": "~1.4.0"
},
"devDependencies": {
"angular-mocks": "1.2.6",
"angular-scenario": "1.2.6"
},
"resolutions": {
"angular": "1.2.6"
}
}
bower cache clean
没有解决这个问题。
为什么凉亭列出ang-changeorg
作为依赖?关于这些angularjs版本依赖如何工作的清晰度将是非常棒的。
答案 0 :(得分:5)
这是因为在你的bower.json中,你的项目名称是ang-changeorg
{
"name": "ang-changeorg",
"version":
该文件中的所有依赖项
"dependencies": {
"angular": "1.2.6",
"json3": "~3.2.6",
"es5-shim": "~2.1.0",
"jquery": "~1.10.2",
...
是“名称”:“ang-changeorg”依赖于。
因此,ang-changeorg依赖于角度#1.2.6,因为角度的1.2.6版本在您的凉亭文件中指定:
"dependencies": {
"angular": "1.2.6",
答案 1 :(得分:4)
bower.json
文件中列出的每个软件包都有自己的bower.json
文件,其中列出了另一组依赖项。
所以,当它说ang-changeorg
有angular#1.2.6
作为依赖时,那是因为ang-changeorg
包中列有angular#1.2.6
个bower.json
{{1}}档案。
答案 2 :(得分:2)
考虑在所有Bower调用中升级到最新的Angular 1.2.18,你有一些混合依赖,很可能Restangular更喜欢最新版本或至少与最新版本匹配(" angular-动画":" ~1.2.16")。
我不认为你会看到任何重大变化。