0

I'm using bower 1.3.12

Here is my bower.json

{
  "name": "my_project",
  "version": "0.0.0",
  "authors": [
    "ME <me@email.com>"
  ],
  "main": "index.php",
  "license": "None",
  "homepage": "http://project.com",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "inuit-layout": "~0.3.2",
    "inuit-starter-kit": "~0.2.8",
    "inuit-widths": "~0.3.2",
    "inuit-widths-responsive": "~0.1.3",
    "inuit-clearfix": "~0.2.1",
    "angular": "~1.3.3",
    "angular-animate": "~1.3.3",
    "dropzone": "~3.12.0",
    "nouislider": "~7.0.10",
    "angular-nouislider": "~0.3.1",
    "angular-google-maps": "~2.0.12",
    "slick-carousel": "~1.3.15",
    "selectize": "~0.8.5",
    "angular-selectize2": "~1.1.1"
  },
  "resolutions": {
    "angular": ">=1.2.18",
    "selectize": ">=0.9.0"
  }
}

Notice I'm using Angular v 1.3

But when I do... bower install magnific-popup --save I see that bower has downgraded Angular to v1.2.28.

I see that 1.2.28 is listed in the resolutions but I don't understand why this has anything to do with installing an unrelated package with no overlapping dependancies.

Why is this happening and how do I fix it?

Update

If I remove the "dependencies" key/value from bower.json, I am prompted with this:

Unable to find a suitable version for angular, please choose one:
    1) angular#~1.2.6 which resolved to 1.2.28 and is required by angular-nouislider#0.3.1 
    2) angular#1.3.3 which resolved to 1.3.3 and is required by angular-animate#1.3.3 
    3) angular#~1.3.3 which resolved to 1.3.13 and is required by letreehouse 
    4) angular#>=1.2.0 which resolved to 1.3.13 and is required by angular-google-maps#2.0.12Prefix the choice with ! to persist it to bower.json

Should I just choose 1.3.13 and move on? Or is should I be worried about a larger problem?

emersonthis
  • 32,822
  • 59
  • 210
  • 375

2 Answers2

0

The resolution block specifies the version to take in case there is a dependency conflict (in your case, you have your own project set to depend on Angular ~1.3.3 but magnific-popup probably requires 1.2.28). Since your resolution is set to >=1.2.18, it takes 1.2.28. When you remove the resolution, it is no longer able to determine which version you want so it asks you. I would try to set resolution to 1.3.13 and see if it affects magnific-popup, if not, continue on.

Hans
  • 2,610
  • 3
  • 17
  • 20
  • But magnific-popup has nothing to do with angular. It shouldn't care whatsoever – emersonthis Feb 21 '15 at 03:14
  • I don't think it is `magnific-popup` causing the issue but the act of doing a `bower install` IIRC bower install other packages too when run on a specific package. Which would cause you to revert to the lower version due to `angular-nouislider` having an older angular version and the resolution allowing it. They could update the resolution to the later Angular version or remove/update `angular-nouislider` to fix the issue. – David Feb 21 '15 at 04:31
  • My bad, didn't look at the conflict prompt closely. David is right, it's probably angular-nouislider that's responsible for the lower Angular version. In any case, if the newer versions of angular-nouislider still requires ~1.2.6 then I think you can still try to resolve to angular#1.3.3 and see if it breaks angular-nouislider. – Hans Feb 21 '15 at 19:05
0

I have a theory about what's going on, but it is only a hunch...

  1. I think that two different packages have a conflict with angular version(s).
  2. I must have resolved the conflict in the past, choosing v1.2.28
  3. I suspect Angular re-evaluates ALL the dependencies every time anything is installed (not just the dependencies of whatever is being installed.
  4. Somehow I managed to set my dependencies in bower.json but not actually re-run the install command for the changes to be applied

Therefore, whenever I try to install ANYTHING, bower checks ALL the dependencies and applies resolutions, which in my case means switching to an earlier version of Angular.

If anyone can confirm / disconfirm any of the points above, I would welcome a better answer than this.

Update @David has confirmed my hunch in the comments above. I ended up setting Angular v1.3.3 as the resolution, which is the version I was already running. So now I can run installs without triggering the downgrade.

emersonthis
  • 32,822
  • 59
  • 210
  • 375