Unhandled promise rejection Error: Zone.js #12

Closed
opened 2017-07-11 09:57:02 +00:00 by Toso82 · 7 comments
Toso82 commented 2017-07-11 09:57:02 +00:00 (Migrated from github.com)

Unhandled promise rejection 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.)
at Function.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.assertZonePatched (zone.js:44)
at new NgZone (core.es5.js:3775)
at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleFactoryWithZone (core.es5.js:4491)
at core.es5.js:4536
at run (es6.promise.js:108)
at es6.promise.js:119
at MutationObserver.flush ($.microtask.js:19)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runGuarded (zone.js:154)
at MutationObserver. (zone.js:132)

When my Angular app start with in function just
Equation.solve('4 * lg(4) ^ 3')

Unhandled promise rejection 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.) at Function.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.assertZonePatched (zone.js:44) at new NgZone (core.es5.js:3775) at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleFactoryWithZone (core.es5.js:4491) at core.es5.js:4536 at run (es6.promise.js:108) at es6.promise.js:119 at MutationObserver.flush ($.microtask.js:19) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runGuarded (zone.js:154) at MutationObserver.<anonymous> (zone.js:132) When my Angular app start with in function just Equation.solve('4 * lg(4) ^ 3')
mdibaiee commented 2017-07-11 13:16:03 +00:00 (Migrated from github.com)

import equations before zone

import `equations` before `zone`
Toso82 commented 2017-07-11 14:08:43 +00:00 (Migrated from github.com)

It is just before zone this is my package,json

{
"name": "my-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.2.6",
"@angular/common": "^4.2.6",
"@angular/compiler": "^4.2.6",
"@angular/core": "^4.2.6",
"@angular/forms": "^4.2.6",
"@angular/http": "^4.2.6",
"@angular/platform-browser": "^4.2.6",
"@angular/platform-browser-dynamic": "^4.2.6",
"@angular/router": "^4.2.6",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"equations": "^1.3.6",
"ng2-bootstrap-modal": "^1.0.1",
"ng2-dnd": "^4.2.0",
"rxjs": "^5.4.2",
"select2": "^4.0.3",
"zone": "^0.3.4",
"zone.js": "^0.8.12"
},
"devDependencies": {
"@angular/cli": "^1.2.0",
"@angular/compiler-cli": "^4.2.6",
"@types/jasmine": "2.5.53",
"@types/jquery": "^3.2.6",
"@types/jqueryui": "^1.11.34",
"@types/node": "^8.0.10",
"@types/select2": "^4.0.37",
"babel": "^6.23.0",
"babel-core": "^6.25.0",
"codelyzer": "~3.1.2",
"jasmine-core": "~2.6.4",
"jasmine-spec-reporter": "^4.1.1",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.5.0",
"typescript": "~2.4.1"
}
}

It is just before zone this is my package,json { "name": "my-app", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^4.2.6", "@angular/common": "^4.2.6", "@angular/compiler": "^4.2.6", "@angular/core": "^4.2.6", "@angular/forms": "^4.2.6", "@angular/http": "^4.2.6", "@angular/platform-browser": "^4.2.6", "@angular/platform-browser-dynamic": "^4.2.6", "@angular/router": "^4.2.6", "bootstrap": "^3.3.7", "core-js": "^2.4.1", "equations": "^1.3.6", "ng2-bootstrap-modal": "^1.0.1", "ng2-dnd": "^4.2.0", "rxjs": "^5.4.2", "select2": "^4.0.3", "zone": "^0.3.4", "zone.js": "^0.8.12" }, "devDependencies": { "@angular/cli": "^1.2.0", "@angular/compiler-cli": "^4.2.6", "@types/jasmine": "2.5.53", "@types/jquery": "^3.2.6", "@types/jqueryui": "^1.11.34", "@types/node": "^8.0.10", "@types/select2": "^4.0.37", "babel": "^6.23.0", "babel-core": "^6.25.0", "codelyzer": "~3.1.2", "jasmine-core": "~2.6.4", "jasmine-spec-reporter": "^4.1.1", "karma": "~1.7.0", "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.3.0", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.2.0", "tslint": "~5.5.0", "typescript": "~2.4.1" } }
mdibaiee commented 2017-07-11 14:22:47 +00:00 (Migrated from github.com)

I mean in your code, import equations first.

this should be the first line of your code:

import { Equation } from "equations";
I mean in your code, import `equations` first. this should be the first line of your code: ``` import { Equation } from "equations"; ```
Toso82 commented 2017-07-12 08:32:21 +00:00 (Migrated from github.com)

hi @mdibaiee
I put import { Equation } from "equations"; at first line of my app.component.ts file but do the same

hi @mdibaiee I put import { Equation } from "equations"; at first line of my app.component.ts file but do the same
mdibaiee commented 2017-07-12 14:41:10 +00:00 (Migrated from github.com)

@Toso82 from what I understand of that error, Zone.js is asking you to import equations before zone

@Toso82 from what I understand of that error, Zone.js is asking you to import `equations` before `zone`
Toso82 commented 2017-07-12 14:46:23 +00:00 (Migrated from github.com)

@mdibaiee ok but i want to use this on angular 4 application. Import equations is on top and I don't impor in this module zone in app.component.ts

import { Equation } from "equations";
import { Component, OnInit, OnChanges, LOCALE_ID, Inject } from '@angular/core';
import { Subject } from './Model/mca.subject'
import { Comparabile } from './Model/mca.comparabile'
import { CaratteristicheService } from './caratteristiche.service'
import { Caratteristica, CaratteristicaInfo,TipoStima} from "./Model/mca.caratteristica";
import { Observable } from "rxjs/Observable";

import { DecimalPipe } from '@angular/common'
import { DialogService } from "ng2-bootstrap-modal";
import { EditCaratteristicheDialogComponent } from "app/component/edit-caratteristiche-dialog/edit-caratteristiche-dialog.component";

I don't know how to put before

@mdibaiee ok but i want to use this on angular 4 application. Import equations is on top and I don't impor in this module zone in app.component.ts import { Equation } from "equations"; import { Component, OnInit, OnChanges, LOCALE_ID, Inject } from '@angular/core'; import { Subject } from './Model/mca.subject' import { Comparabile } from './Model/mca.comparabile' import { CaratteristicheService } from './caratteristiche.service' import { Caratteristica, CaratteristicaInfo,TipoStima} from "./Model/mca.caratteristica"; import { Observable } from "rxjs/Observable"; import { DecimalPipe } from '@angular/common' import { DialogService } from "ng2-bootstrap-modal"; import { EditCaratteristicheDialogComponent } from "app/component/edit-caratteristiche-dialog/edit-caratteristiche-dialog.component"; I don't know how to put before
mdibaiee commented 2017-07-12 14:49:51 +00:00 (Migrated from github.com)

@Toso82: Sorry, I really have no idea, maybe TypeScript is importing zone

@Toso82: Sorry, I really have no idea, maybe TypeScript is importing zone
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: thereadme/Equation.js#12
No description provided.