Angular 2无法使用MS Edge

时间:2016-09-16 22:18:00

标签: javascript angular microsoft-edge

当我在MS Edge中加载我的应用时出现脚本错误。但是Firefox,Chrome,IE11都可以工作,除了Edge ......

这是控制台的屏幕截图:

enter image description here

见这里:

HTML1300: Navigation occurred.
localhost:23752
SCRIPT65535: Argument not optional
zone.js (556,13)
SCRIPT257: Could not complete the operation due to error 80020101.
localhost:23752 (1,1)
Unhandled Promise rejection: 'Zone' is undefined ; Zone: <root> ; Task:     Promise.then ; Value: ReferenceError: 'Zone' is undefined ReferenceError: 'Zone' is undefined
at NgZoneImpl (eval code:8749:13)
at NgZone (eval code:8902:13)
at PlatformRef_.prototype._bootstrapModuleFactoryWithZone (eval code:9447:17)
at Anonymous function (eval code:9489:50)
at ZoneDelegate.prototype.invoke (http://localhost:23752/node_modules/zone.js/dist/zone.js:190:13)
at Zone.prototype.run (http://localhost:23752/node_modules/zone.js/dist/zone.js:85:17)
at Anonymous function (http://localhost:23752/node_modules/zone.js/dist/zone.js:451:17)
at ZoneDelegate.prototype.invokeTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:223:17)
at Zone.prototype.runTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:125:21)
at drainMicroTaskQueue (http://localhost:23752/node_modules/zone.js/dist/zone.js:357:25)
zone.js (344,13)
"Unhandled Promise rejection:"
"'Zone' is undefined"
"; Zone:"
"<root>"
"; Task:"
"Promise.then"
"; Value:"
{
  [functions]: ,
  __proto__: { },
  description: "'Zone' is undefined",
  message: "'Zone' is undefined",
  name: "ReferenceError",
  number: -2146823279,
  stack: "ReferenceError: 'Zone' is undefined
 at NgZoneImpl (eval code:8749:13)
 at NgZone (eval code:8902:13)
 at PlatformRef_.prototype._bootstrapModuleFactoryWithZone (eval code:9447:17)
 at Anonymous function (eval code:9489:50)
 at ZoneDelegate.prototype.invoke (http://localhost:23752/node_modules/zone.js/dist/zone.js:190:13)
 at Zone.prototype.run (http://localhost:23752/node_modules/zone.js/dist/zone.js:85:17)
 at Anonymous function (http://localhost:23752/node_modules/zone.js/dist/zone.js:451:17)
 at ZoneDelegate.prototype.invokeTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:223:17)
 at Zone.prototype.runTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:125:21)
 at drainMicroTaskQueue (http://localhost:23752/node_modules/zone.js/dist/zone.js:357:25)"
}
"ReferenceError: 'Zone' is undefined
at NgZoneImpl (eval code:8749:13)
at NgZone (eval code:8902:13)
at PlatformRef_.prototype._bootstrapModuleFactoryWithZone (eval code:9447:17)
at Anonymous function (eval code:9489:50)
at ZoneDelegate.prototype.invoke (http://localhost:23752/node_modules/zone.js/dist/zone.js:190:13)
at Zone.prototype.run (http://localhost:23752/node_modules/zone.js/dist/zone.js:85:17)
at Anonymous function (http://localhost:23752/node_modules/zone.js/dist/zone.js:451:17)
at ZoneDelegate.prototype.invokeTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:223:17)
at Zone.prototype.runTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:125:21)
at drainMicroTaskQueue (http://localhost:23752/node_modules/zone.js/dist/zone.js:357:25)"

Error: Uncaught (in promise): ReferenceError: 'Zone' is undefined
zone.js (346,9)
{
  [functions]: ,
  __proto__: { },
  description: "Uncaught (in promise): ReferenceError: 'Zone' is undefined",
  message: "Uncaught (in promise): ReferenceError: 'Zone' is undefined",
  name: "Error",
  promise: { },
  rejection: { },
  stack: "Error: Uncaught (in promise): ReferenceError: 'Zone' is undefined
 at resolvePromise (http://localhost:23752/node_modules/zone.js/dist/zone.js:418:25)
 at Anonymous function (http://localhost:23752/node_modules/zone.js/dist/zone.js:454:17)
 at ZoneDelegate.prototype.invokeTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:223:17)
 at Zone.prototype.runTask (http://localhost:23752/node_modules/zone.js/dist/zone.js:125:21)
 at drainMicroTaskQueue (http://localhost:23752/node_modules/zone.js/dist/zone.js:357:25)
 at g (http://localhost:23752/node_modules/core-js/client/shim.min.js:8:10014)
 at Anonymous function (http://localhost:23752/node_modules/core-js/client/shim.min.js:8:10138)
 at k (http://localhost:23752/node_modules/core-js/client/shim.min.js:8:14293)",
  task: {
     [functions]: ,
     __proto__: { },
     cancelFn: null,
     data: undefined,
     runCount: 1,
     scheduleFn: undefined,
     source: "Promise.then",
     type: "microTask",
     zone: { }
   },
   zone: {
     [functions]: ,
     __proto__: { },
     _name: "<root>",
     _parent: null,
     _properties: { },
     _zoneDelegate: { },
     name: "<root>",
     parent: null
   }
}

我还注意到第556行的zone.js中的Argument not optional

位于

 if (NativePromise) {
    patchThen(NativePromise);
    if (typeof global['fetch'] !== 'undefined') {
        var fetchPromise = global['fetch']();
        // ignore output to prevent error;
        fetchPromise.then(function () { return null; }, function () { return null; });
        if (fetchPromise.constructor != NativePromise) {
            patchThen(fetchPromise.constructor);
        }
    }
}

,具体行是:

var fetchPromise = global['fetch']();

然后出现了令人担忧的错误:&#34;由于错误80020101&#34;无法完成操作;

该问题有很多解决方案,删除了双重删除注释或脚本标记内的html注释,但没有一个能够正常工作。

Error 80020101

有没有人有线索?

我正在使用最新的MS内幕预览Edge 39.14915。

3 个答案:

答案 0 :(得分:4)

我通过更新zone.js从0.6.21 =&gt;修复了这个问题。 0.6.25,可在CDN这里https://unpkg.com/zone.js@0.6.25?main=browser或从他们的github存储库获得。

答案 1 :(得分:2)

确认此错误是由于Windows 10 Insider预览与Ms Edge 39.14915特别是方法global['fetch']();

答案 2 :(得分:0)

取消注释应用程序中polyfills.ts文件中的polyfill,请参阅此答案以供参考Angular2 app is not working on Microsoft edge