【问题标题】:AngularJS application deployment to Heroku, unable to find suitable angular-animate versionAngularJS 应用程序部署到 Heroku,找不到合适的 angular-animate 版本
【发布时间】:2015-07-09 05:26:13
【问题描述】:

我正在将 AngularJS 应用程序部署到 Heroku,但在控制台中收到此错误:

remote: bower    ECONFLICT Unable to find suitable version for angular-animate
remote: 
remote:  !     Push rejected, failed to compile Node.js app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to test-app-12345

问题(当然)似乎出在angular-animate 依赖项上。

我正在使用 Heroku angularJS buildpack "Yo Angular" 并按照他们的 4 步流程成功将应用程序部署到 Heroku。

我尝试按照this StackOverflow answer 中的建议更改我的bower.json 文件来解决此问题,希望它能解决我的问题。它没有。

在本地,我使用grunt serve 启动应用程序,这对我来说很好用。

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

{
  "name": "dashboard",
  "version": "0.0.0",
  "main": "index.html",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components"
  ],
  "dependencies": {
    "jquery": "~2.0",
    "bootstrap": "~3.1.1",
    "angular": "~1.3.15",
    "angular-ui-router": "~0.2",
    "angular-animate": "~1.3.15",
    "angular-resource": "~1.3.15",
    "angular-cookies": "~1.3.15",
    "angular-mocks": "~1.3.15",
    "angular-ui-utils": "~0.1",
    "angular-bootstrap": "~0.11.2",
    "moment": "~2.5",
    "less.js": "~1.6",
    "font-awesome": "~4.2.0",
    "form-builder": "0.1.0",
    "restangular": "~1.4.0",
    "lodash": "~2.4.1",
    "satellizer": "~0.3.2",
    "angular-xeditable": "~0.1.8",
    "fullcalendar": "~2.1.1",
    "angular-ui-calendar": "~0.8.1",
    "checklist-model": "~0.1.3"
  },
  "resolutions": {
    "font-awesome": "~4.2.0",
    "jquery": "~2.0",
    "fullcalendar": "~2.1.1",
    "angular": "~1.3.15",
    "angular-bootstrap": "~0.11.2"
  }
}

代码现在是公开的,所以这里是Github repo的链接。

任何人都可以给我一些建议,或者知道我做错了什么?

附:我在bower 的Github 问题跟踪中找到了this information,它正在处理同样的问题。可能有助于弄清楚这一点。

【问题讨论】:

  • 似乎找不到适合angular-animate 的版本,因为~1.3.x 中的x。尝试声明特定版本,如~1.3.15。我认为它会为其他 .x 版本抛出错误。尝试替换它。
  • 您更新了所有的.x 版本还是只更新了angular-animate
  • 只是角度动画,我想因为这是唯一一个给我错误的......但我会回去尝试一下。
  • 是的,都更新了。还是不行。
  • 好的。我仍在调查您的错误。得到解决方案后,我会与您联系。

标签: angularjs heroku bower


【解决方案1】:

当两个包引用同一依赖项的不同版本时会发生此错误。

您可以通过运行rm -rf bower_components/ ; bower install来解决此问题

然后,当系统提示您选择版本时,请在您的答案前加上“!”就像我在下面一样。 注意 bower 如何添加 "resolutions" 部分。

Unable to find a suitable version for angular-animate, please choose one:
    1) angular-animate#~1.2 which resolved to 1.2.28 and is required by form-builder#0.1.0
    2) angular-animate#~1.3.15 which resolved to 1.3.17 and is required by dashboard
    3) angular-animate#~1.4.3 which resolved to 1.4.3

Prefix the choice with ! to persist it to bower.json

? Answer: !3

这是您已解析的 bower.json 文件。

{
  "name": "dashboard",
  "version": "0.0.0",
  "main": "index.html",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components"
  ],
  "dependencies": {
    "jquery": "~2.0",
    "bootstrap": "~3.1.1",
    "angular": "~1.3.15",
    "angular-ui-router": "~0.2",
    "angular-animate": "~1.4.3",
    "angular-resource": "~1.3.15",
    "angular-cookies": "~1.3.15",
    "angular-mocks": "~1.3.15",
    "angular-ui-utils": "~0.1",
    "angular-bootstrap": "~0.11.2",
    "moment": "~2.5",
    "less.js": "~1.6",
    "font-awesome": "~4.2.0",
    "form-builder": "0.1.0",
    "restangular": "~1.4.0",
    "lodash": "~2.4.1",
    "satellizer": "~0.3.2",
    "angular-xeditable": "~0.1.8",
    "fullcalendar": "~2.1.1",
    "angular-ui-calendar": "~0.8.1",
    "checklist-model": "~0.1.3"
  },
  "resolutions": {
    "font-awesome": "~4.2.0",
    "jquery": "~2.0",
    "fullcalendar": "~2.1.1",
    "angular": "~1.3.15",
    "angular-bootstrap": "~0.11.2",
    "angular-animate": "~1.4.3"
  }
}

【讨论】:

  • 完美。哈哈,我实际上所要做的就是rm -rf bower_components/ ; bower install——然后我就可以走了!
猜你喜欢
  • 2017-05-24
  • 1970-01-01
  • 2014-04-07
  • 2017-01-31
  • 2018-05-31
  • 2014-11-21
  • 2017-12-09
  • 2017-04-22
相关资源
最近更新 更多