如何在zone.js中找到错误来源 - ' filter'未定义的

时间:2018-01-29 19:19:45

标签: javascript angular

我已将我的Angular版本从4升级到5,并且在解决一些问题时,我注意到我收到的错误似乎无法追踪到。这可能与升级无关,可能与我的数据太旧(超出选择范围)有关。但是我得到了以下的痕迹:

Uncaught TypeError: Cannot read property 'filter' of undefined
    at backend.js:9584
    at Array.map (<anonymous>)
    at getDependencies (backend.js:9583)
    at Object.exports.transform (backend.js:9504)
    at backend.js:9511
    at Array.forEach (<anonymous>)
    at transformChildren (backend.js:9510)
    at Object.exports.transform (backend.js:9526)
    at backend.js:9511
    at Array.forEach (<anonymous>)

此处出现错误:zone.js:

    Zone.prototype.runTask = function (task, applyThis, applyArgs) {
        if (task.zone != this) {
            throw new Error('A task can only be run in the zone of creation! (Creation: ' +
                (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
        }
        // https://github.com/angular/zone.js/issues/778, sometimes eventTask
        // will run in notScheduled(canceled) state, we should not try to
        // run such kind of task but just return
        // we have to define an variable here, if not
        // typescript compiler will complain below
        var isNotScheduled = task.state === notScheduled;
        if (isNotScheduled && task.type === eventTask) {
            return;
        }
        var reEntryGuard = task.state != running;
        reEntryGuard && task._transitionTo(running, scheduled);
        task.runCount++;
        var previousTask = _currentTask;
        _currentTask = task;
        _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
        try {
            if (task.type == macroTask && task.data && !task.data.isPeriodic) {
                task.cancelFn = null;
            }
            try {
                return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
            }
            catch (error) {
                if (this._zoneDelegate.handleError(this, error)) {
                    // >>>>> Caught and rethrown here:
                    throw error;
                }
            }
        }

我自然而然地看着我对&#34;过滤器&#34;的使用。确保他们能够防止这种类型的错误。我还没有发现问题(还)。有关如何追踪此类错误来源的任何想法?谢谢!

1 个答案:

答案 0 :(得分:1)

我猜你也在使用Augury,这导致了这个错误。 卸载它,错误将消失。 链接为您提供帮助 https://github.com/rangle/augury/issues/1255