Javascript angular js 未知提供程序错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32011536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 07:31:14  来源:igfitidea点击:

angular js unknown provider error angular-animate

javascriptangularjs

提问by Pranav Kumar

After removing bower_components and making a cache clean I reinstalled dependencies using bower install. The app fails to load with following error Uncaught Error: [$injector:unpr] Unknown provider: $$forceReflowProvider <- $$forceReflow <- $$animateQueue <- $animate <- $compile <- $$animateQueue

删除 bower_components 并清理缓存后,我使用 bower install 重新安装了依赖项。应用程序无法加载,出现以下错误未捕获错误:[$injector:unpr] 未知提供者:$$forceReflowProvider <- $$forceReflow <- $$animateQueue <- $animate <- $compile <- $$animateQueue

Here is my bower.json

这是我的 bower.json

{
  "name": "angular-zolo",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.4.3",
    "json3": "~3.3.1",
    "es5-shim": "~3.0.1",
    "bootstrap-sass-official": "~3.1.1",
    "bootstrap": "~3.1.1",
    "angular-resource": ">=1.2.*",
    "angular-cookies": ">=1.2.*",
    "angular-sanitize": ">=1.2.*",
    "angular-bootstrap": "~0.11.0",
    "font-awesome": ">=4.1.0",
    "lodash": "~2.4.1",
    "angular-socket-io": "~0.6.0",
    "angular-ui-router": "~0.2.15",
    "angular-material": "master",
    "material-date-picker": "~1.1.7",
    "ng-table": "~0.7.1",
    "md-data-table": "*",
    "ngstorage": "~0.3.7",
    "ng-file-upload": "~6.0.4",
    "velocity": "~1.2.2",
    "nprogress": "~0.2.0"

  },
  "devDependencies": {
    "angular-mocks": ">=1.2.*",
    "angular-scenario": ">=1.2.*"
  },
  "resolutions": {
    "angular-material": "master",
    "angular": "~1.4.0",
    "lodash": "~3.9.3"

  }
}

采纳答案by Sofiene Djebali

Angular-animate is not in your bower.json file, :) install it with :

Angular-animate 不在您的 bower.json 文件中,:) 使用以下命令安装它:

bower install angular-animate --save

回答by TrophyGeek

Just to highlight what Oliviersaid in a comment, make sure you keep your version of angular and angular-animate in sync.

只是为了突出Olivier在评论中所说的话,请确保您的 angular 和 angular-animate 版本保持同步。

From bower.json

来自 bower.json

Good

好的

  "dependencies": {
    "angular": "~1.4.6",
    "angular-animate": "~1.4.6",

Bad- out of sync

-不同步

  "dependencies": {
    "angular": "~1.4.0",
    "angular-animate": "~1.4.6",

回答by Stefan Sch?fer

Had the same problem with version >=1.4.4 of angular-animate. Use version 1.4.3 until it's fixed in a future release.

angular-animate 的 >=1.4.4 版本也有同样的问题。使用版本 1.4.3,直到它在未来版本中得到修复。

回答by Akhter Al Amin

I solved it installing angular-animate like this:

我解决了它安装 angular-animate 这样的问题:

bower install angular-animate#x.x.x

x.x.x is the version number equals to angular version.

xxx 是版本号,等于 angular 版本。