Unable to find a suitable version for angular - bower install

后端 未结 6 1144
时光取名叫无心
时光取名叫无心 2020-12-02 16:45

I have set up my Angular app so when it\'s pushed to Heroku it runs bower install. However I\'m getting errors due to version issues.

When I run b

相关标签:
6条回答
  • 2020-12-02 17:11

    Update your current angular dependencies to 1.3.x and add a resolution for angular to suppress the prompt:

    {
      "name": "myapp",
      "version": "0.0.1",
      "dependencies": {
        "angular": "~1.3.x",
        "angular-animate": "~1.3.x",
        "angular-cookies": "~1.3.x",
        "angular-resource": "~1.3.x",
        "angular-sanitize": "~1.3.x",
        "angular-ui-router": "~0.2.10",
        "angular-ui-codemirror": "~0.1.6",
        "angular-elastic": "~2.4.0",
        "angular-local-storage": "~0.0.7",
        "angular-nanoscroller": "~0.2.1",
        "angular-sockjs": ">=0.0.1",
        "json3": "~3.3.1",
        "es5-shim": "~3.1.0",
        "jquery": "~2.1.1",
        "splitter": "*",
        "chance": "~0.5.6",
        "nanoscroller": "~0.8.4"
      },
      "resolutions": {
        "angular": "~1.3.x"
      }
    }
    
    0 讨论(0)
  • 2020-12-02 17:11

    You can run the install command and when it prompts for selection of version then use (!) exclamation mark as prefix to option. For example !3 for third option. This would then get added to bower.json file of your application and resolve the conflict.

    Hope this helps.

    0 讨论(0)
  • 2020-12-02 17:19

    Delete your /bower_components directory and run bower install again..

    A hack but works nevertheless..!!

    0 讨论(0)
  • 2020-12-02 17:19

    First try this:
    npm install -g bower

    If above solution does not work then, Try:

    bower update
    Worked for me.

    0 讨论(0)
  • 2020-12-02 17:25

    A very good explanation and resolution of the issue can be found here:

    bower-resolutions

    Just copy pasting some lines here for reference:

    When you specify dependencies for you app via Bower, some of the packages might rely on different versions of the same library. You will have to resolve what version of libraries your app actually wants. In other words, you break the tie. But you don’t want to break it every time, so save your choice.

    When you run bower install, the resolution process is interactive. When bower recognizes that there are two packages that depend on a package at different versions, it’ll list all those versions and ask:

    The next line in the prompt is very handy. It reads:

    Awesome! So, if I type !2 instead, my choice is saved in bower.json. Specifically, it’ll add a resolutions entry:

    Now, the next time you run bower install, there is no interactive question of what version I want because I’ve already resolved that ember for my app should be version 1.5.1.

    0 讨论(0)
  • 2020-12-02 17:26

    You should update bower (It works for me):

    bower update
    
    0 讨论(0)
提交回复
热议问题