bower update
命令结束时。我发现了这个警告:
Please note that,
angular-bootstrap#2.5.0 depends on angular#>=1.4.0 which resolved to angular#1.5.11
angularytics#0.4.0 depends on angular#* which resolved to angular#1.5.11
angular-gettext#2.3.8 depends on angular#>=1.2.0 which resolved to angular#1.5.11
angular-pnotify#0.1.2 depends on angular#~1.5.5 which resolved to angular#1.5.11
angular-local-storage#0.5.2 depends on angular#^1.x which resolved to angular#1.5.11
angular-marked#1.2.2 depends on angular#>= 1.3.0 which resolved to angular#1.5.11
ng-videosharing-embed#0.3.7 depends on angular#>= 1.2.0 which resolved to angular#1.5.11
ngSmoothScroll#2.0.0 depends on angular#^1.2.0 which resolved to angular#1.5.11
ng-file-upload#12.2.13 depends on angular#>1.2.0 which resolved to angular#1.5.11
ng-sortable#1.3.7 depends on angular#>=1.3.0 which resolved to angular#1.5.11
textAngular#1.5.16 depends on angular#>=1.3.x which resolved to angular#1.5.11
angular-animate#1.6.1, angular-cookies#1.6.1, angular-resource#1.6.1, angular-route#1.6.1, angular-sanitize#1.6.1, angular-touch#1.6.1 depends on angular#1.6.1 which resolved to angular#1.6.1
the-web-project depends on angular#~1.6.1 which resolved to angular#1.6.1
Resort to using angular#~1.6.1 which resolved to angular#1.6.1
Code incompatibilities may occur.
我的结论是,我的应用程序上有两个版本的角度运行。这是真的?有没有一种简单的方法可以解决这个问题?
修改
我正在添加bower.json
,因为它已包含指定resolutions
版本的angular
部分。
{
"name": "my-web-project",
"version": "2.3.0",
"dependencies": {
"jquery": "~3.1.1",
"angular": "~1.6.1",
"angular-animate": "~1.6.1",
"angular-bootstrap": "~2.5.0",
"angular-bootstrap-colorpicker": "~3.0.25",
"angular-cookies": "~1.6.1",
"angular-gettext": "~2.3.8",
"angular-local-storage": "~0.5.2",
"angular-marked": "~1.2.2",
"angular-pnotify": "~0.1.2",
"angular-resource": "~1.6.1",
"angular-route": "~1.6.1",
"angular-sanitize": "~1.6.1",
"angularytics": "~0.4.0",
"base64-angular": "~1.0.0",
"bootstrap": "~3.3.7",
"es5-shim": "~4.5.9",
"jquery-ui": "~1.12.1",
"json3": "~3.3.2",
"marked": "~0.3.6",
"md5-jkmyers": "~0.0.1",
"moment": "~2.17.1",
"momentjs": "~2.17.1",
"ng-file-upload": "~12.2.13",
"ng-sortable": "~1.3.7",
"ngSmoothScroll": "~2.0.0",
"textAngular": "~1.5.16",
"underscore": "~1.8.3",
"underscore.string": "~3.3.4",
"angular-touch": "~1.6.1",
"ng-videosharing-embed": "~0.3.7",
"ua-parser-js": "~0.7.12",
"angular-spinners": "~3.1.2",
"angular-i18n": "^1.6.1",
"angular.uuid2": "angular-uuid2#*"
},
"devDependencies": {},
"resolutions": {
"angular": "~1.6.1",
"jquery": "~3.1.1"
},
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
},
"pnotify": {
"main": [
"dist/pnotify.js",
"dist/pnotify.css",
"dist/pnotify.buttons.css",
"dist/pnotify.buttons.js"
]
}
}
}
答案 0 :(得分:1)
每个bower组件都有自己的依赖项。这可能是一系列版本或固定的静态版本。如果多个组件在不同版本中需要角度(不重叠版本范围),则会出现此警告。然后,您可以通过定义例如resolution
来确定应包含哪个版本。角度并设置固定版本。这可能会在运行时导致不兼容,但最终,项目中只运行一个版本。通常,如果只有一个或两个依赖项需要较旧版本的角度,则不会出现问题。
以下是另一个问题的答案,它解释了决议的定义:link。