question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten

See original GitHub issue

There is error when exceljs is used in code.

Error:

Error: “Zone.js has detected that ZoneAwarePromise (window|global).Promise has been overwritten. Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)” Angular 5 o exceljs.min.js:3

My service.ts file

import { Injectable } from '@angular/core'; import * as Excel from "exceljs/dist/exceljs.min.js"; import * as fs from 'file-saver'; @Injectable({ providedIn: 'root' }) export class ExcelserviceService {

constructor() { }

generatereport(dummydata):void{

let workbook = new Excel.Workbook();

let worksheet = workbook.addWorksheet('Car Data');

} }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

20reactions
inyourdrimzcommented, Nov 18, 2019

fixed mine by importing it before ‘core-js’ and ‘zone.js’ in the pollyfills.ts file

pollyfills.ts file:

import 'exceljs/dist/exceljs.min.js';

/** IE9, IE10 and IE11 requires all of the following polyfills. */
import 'core-js/es6/symbol';
.
.
. 
.
.
.
import 'zone.js/dist/zone';
2reactions
bleuscythercommented, Nov 20, 2019

I suggested a PR that should fix this issue. You can download it and build to test the excelis.min files.

It worked for me i did not need to import in the polyfill.ts anymore.

import {Row, Workbook, Worksheet} from 'exceljs';
...
    const workbook: Workbook = new Workbook();

    const sheet: Worksheet = workbook.addWorksheet( ....

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled promise rejection: Zone.js has detected that ...
Unhandled promise rejection: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten ; "site-pinger" · "version" ...
Read more >
Zone.js has detected that ZoneAwarePromise `(window|global ...
Error: "Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten. Most likely cause is that a Promise ...
Read more >
Angular – Zone.js has detected that ZoneAwarePromise ...
Angular – Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten in custom element.
Read more >
Js (forked) - StackBlitz
Promise !==D. ZoneAwarePromise)throw new Error("Zone.js has. detected that ZoneAwarePromise `(window|. global).Promise` has been overwritten.\nMost.
Read more >
Error: Zone.js has detected that ZoneAwarePromise (window
Ng test zone js has detected that ZoneAwarePromise window global Promise has been overwritten · Unhandled Promise rejection Zone: <root> ; Task: Promise...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found