AngularJS应用程序部署到Heroku,无法找到合适的角度动画版本

时间:2015-07-09 05:26:14

标签: angularjs heroku bower

我正在向Heroku部署AngularJS应用程序,但在控制台中出现此错误:

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的链接。

任何人都有我的提示,或者对我做错了什么不知所措?

P.S。我在bower的Github问题跟踪中发现this information,这是在处理同样的问题。可能有助于搞清楚这一点。

1 个答案:

答案 0 :(得分:5)

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

您可以通过运行rm -rf bower_components/ ; bower install

来解决此问题

然后当提示您选择版本前缀时,您的答案为“!”就像我在下面。 请注意投标者将如何添加"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"
  }
}