app.min.js:7错误:[$ rootScope:infdig] 10 $ digest()迭代达成。中止!观察者在最近5次迭代中被解雇

时间:2016-09-03 01:12:44

标签: javascript angularjs node.js bower npm-install

以下是每次npm start我的应用时浏览器都会抛出的错误。
enter image description here

这是我的bower.json文件:

{
    "name": "myapp",
    "version": "1.3.0",
    "authors": "My example",
    "description": "AngularJs Bootstrap example",
    "keywords": ["AngularJS", "admin", "admin", "dashboard", "admin", "panel", "app", "charts", "components", "flat", "flat", "ui", "responsive", "responsive", "layout", "ui", "kit", "ui", "route", "web", "app", "widgets"],
    "license": "ISC",
    "homepage": "http://example/com",
    "private": true,
    "ignore": ["**/.*", "node_modules", "bower_components", "test", "tests"],
    "dependencies": {

        "jquery": "~2.1.3",
        "fastclick": "~1.0.6",

        "angular": "~1.5.x",
        "angular-animate": "~1.5.x",
        "angular-cookies": "~1.5.x",
        "angular-resource": "~1.5.x",
        "angular-sanitize": "~1.5.x",
        "angular-touch": "~1.5.x",
        "angular-ui-router": "~0.3.x",
        "ngstorage": "~0.3.x",
        "angular-translate": "~2.11.x",
        "angular-translate-loader-url": "~2.11.x",
        "angular-translate-loader-static-files": "~2.11.x",
        "angular-translate-storage-cookie": "~2.11.x",
        "angular-translate-storage-local": "~2.11.x",
        "oclazyload": "~0.6.3",
        "angular-breadcrumb": "~0.4.x",
        "angular-bootstrap": "~1.1.x",
        "angular-loading-bar": "~0.9.x",
        "angular-scroll": "~1.0.x",
        "angular-moment": "~1.0.x",
        "AngularJS-Toaster": "~2.0.x",
        "angular-bootstrap-nav-tree": "*",
        "angular-ladda": "~0.4.x",
        "ng-table": "~0.5.4",
        "angular-ui-select": "~0.11.1",
        "angular-ui-utils": "mask-0.2.2",
        "ngImgCrop": "~0.3.2",
        "angular-file-upload": "~1.1.5",
        "angular-aside": "~1.1.3",
        "angular-truncate": "*",
        "angular-sweetalert-promised": "~1.0.4",
        "angular-elastic": "~2.4.2",
        "ngmap": "~1.4.2",
        "tc-angular-chartjs": "~1.0.9",
        "angular-ui-switch": "~0.1.0",
        "angular-ckeditor": "~0.3.2",
        "angular-bootstrap-calendar": "~0.7.0",
        "angular-xeditable": "~0.1.8",
        "checklist-model": "~0.2.4",
        "ng-nestable": "~0.0.1",
        "ng-flow": "~2.6.0",
        "v-accordion": "~1.2.1",

        "components-modernizr": "~2.8.3",
        "moment": "~2.8.3",
        "perfect-scrollbar": "~0.6.1",
        "ladda": "~0.9.7",
        "sweetalert": "~0.4.2",
        "chartjs": "~1.0.2",
        "jquery.sparkline.build": "~2.1.3",
        "ckeditor": "~4.4.7",
        "jquery-nestable": "v1.0",
        "spin.js": "~2.0.2",
        "bootstrap-touchspin": "~3.0.1",
        "select2": "~4.0.0",
        "select2-bootstrap-css": "~1.4.6",
        "selectize": "~0.12.0",

        "animate.css": "~3.2.0",
        "font-awesome": "~4.2.0",
        "themify-icons": "~0.1.0",
        "bootstrap": "~3.3.7",
        "bootstrap-rtl": "~3.3.1"
    },
    "resolutions": {
        "angular": "~1.5.x"
    }
}


当我运行安装我的bower依赖项时,我会收到很多提示,要求选择我要安装的软件包版本。
有人能告诉我问题究竟在哪里吗?

2 个答案:

答案 0 :(得分:0)

这很可能是由于您的应用程序中的代码而与您的bower依赖关系无关。你可以发布你的代码吗?

答案 1 :(得分:0)

你似乎遇到了两个不同的问题。

第一个是当角度检测到它的摘要周期被抛入无限循环时产生的角度误差(你可以在这里阅读更多相关信息:https://docs.angularjs.org/error/ $ rootScope / infdig)。检查您的代码,了解观察者可能正在更新正在监视的值或其他一些循环范围更改的问题。

第二个问题是与您的图书馆的凉亭冲突。 Bower试图在它克隆的包之间强制执行平面层次结构,这在浏览器中是可取的,因为它减少了文件大小/有效负载。但为了做到这一点,它必须确保它不安装各种软件包的多个版本,并且它不知道它应该使用哪个版本,因此它需要用户输入来确定。您很可能有许多包请求其依赖项的冲突版本。您可以使用bower界面选择您喜欢的版本或手动执行此操作(How to resolve Bower dependency version conflicts?有良好的说明)。

您可以尝试使用bower的另一件事是为您的包使用特定的版本号。使用〜或.x允许bower根据semver规则包含包,如下所述:What is the bower (and npm) version syntax?。这使得依赖项之间的冲突更可能发生。同时使用〜和.x也是不寻常的,因为它们都执行相同的功能。