无法找到合适的角度 - 凉亭安装版本

时间:2014-09-18 14:40:20

标签: angularjs heroku bower

我已经设置了我的Angular应用程序,所以当它被推送到Heroku时它会运行bower install。但是由于版本问题,我收到了错误。

当我在本地运行bower install时,我会看到:

Unable to find a suitable version for angular, please choose one:                                                                           
    1) angular#1.2.16 which resolved to 1.2.16 and is required by angular-resource#1.2.16                                                   
    2) angular#1.2.23 which resolved to 1.2.23 and is required by angular-cookies#1.2.23                                                    
    3) angular#>= 1.0.8 which resolved to 1.2.25 and is required by angular-ui-router#0.2.10                                                
    4) angular#^1 which resolved to 1.2.25 and is required by angular-ui-codemirror#0.1.6                                                   
    5) angular#~1.2.2 which resolved to 1.2.25 and is required by splitter#f5c2195050                                                       
    6) angular#>=1.0.6 which resolved to 1.2.25 and is required by angular-elastic#2.4.0                                                    
    7) angular#~1.2 which resolved to 1.2.25 and is required by angular-nanoscroller#0.2.1                                                  
    8) angular#~1.2.9 which resolved to 1.2.25 and is required by angular-sockjs#0.0.1Prefix the choice with ! to persist it to bower.json  

? Answer::  

我应该怎么做 - 由于去抖功能

,我实际上需要Angular 1.3版

我的bower.json看起来像这样:

{
  "name": "myapp",
  "version": "0.0.1",
  "dependencies": {
    "json3": "~3.3.1",
    "es5-shim": "~3.1.0",
    "angular-resource": "1.2.16",
    "angular-sanitize": "1.2.16",
    "angular-animate": "1.2.16",
    "angular-ui-router": "~0.2.10",
    "jquery": "~2.1.1",
    "angular-ui-codemirror": "~0.1.6",
    "splitter": "*",
    "angular-cookies": "~1.2.23",
    "angular-elastic": "~2.4.0",
    "angular-local-storage": "~0.0.7",
    "chance": "~0.5.6",
    "nanoscroller": "~0.8.4",
    "angular-nanoscroller": "~0.2.1",
    "angular-sockjs": "~0.0.1"
  }
}

6 个答案:

答案 0 :(得分:74)

将当前的角度依赖关系更新为1.3.x,并为angular添加分辨率以抑制提示:

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

答案 1 :(得分:19)

可以在此处找到对该问题的非常好的解释和解决方案:

bower-resolutions

只需复制粘贴一些行以供参考:

当您通过Bower为您的app指定依赖项时,某些软件包可能依赖于同一个库的不同版本。您必须解决您的应用实际需要的库版本。换句话说,你打破了平局。但是你不想每次都打破它,所以保存你的选择。

当您运行bower install时,解析过程是交互式的。当bower认识到有两个包依赖于不同版本的包时,它会列出所有这些版本并询问:

enter image description here

提示中的下一行非常方便。它写着:

enter image description here

真棒!所以,如果我输入!2,我的选择将保存在bower.json中。具体来说,它将添加一个解决方案条目:

enter image description here

现在,下次你运行bower install时,没有我想要的版本的交互式问题,因为我已经解决了我的应用程序的ember应该是版本1.5.1。

答案 2 :(得分:9)

你应该更新凉亭(它适用于我):

bower update

答案 3 :(得分:3)

删除 / bower_components 目录并再次运行bower install ..

一个黑客,但仍然工作.. !!

答案 4 :(得分:1)

您可以运行install命令,当它提示选择版本时,请使用(!)感叹号作为选项的前缀。例如!3为第三选项。 然后将其添加到应用程序的bower.json文件中并解决冲突。

希望这有帮助。

答案 5 :(得分:0)

先尝试一下:
npm install -g bower

如果上述解决方案无效,请尝试:

更新
为我工作。