mickro
mickro

Reputation: 891

Bower: multi versions of angular seem to run on my project

At the end of bower update command. I found this warning:

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.

I'm concluding, that there are two versions of angular running on my app. Is this true? Is there an easy way to solve this?

edit

I'm adding my bower.json because it is already contains a resolutions section which specify angular version.

{
  "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"
      ]
    }
  }
}

Upvotes: 0

Views: 365

Answers (1)

ssc-hrep3
ssc-hrep3

Reputation: 16069

Every bower component has its own dependencies. This may be in a range of versions or a fixed static version. If the several components require angular in different versions (not overlapping version range), this warning occurs. You can then decide, which version should be included, by defining a resolution of e.g. angular and set a fixed version. This may lead to incompatibilities when it is running, but at the end, there is only one version running in your project. Usually, it is not a problem, if only one or two dependencies require an older version of angular.

Here is an answer of another question, which explains the definition of resolutions: link.

Upvotes: 1

Related Questions