17

I am getting the error message:

Unhandled Promise rejection: Zone.assertZonePatched is not a function

Although I am importing zonejs correctly in index.html:

  <script src="https://unpkg.com/zone.js@0.6.17/dist/zone.js"></script>

Here is the code:

Plnkr: http://plnkr.co/edit/zZYOcgxcRINx23JhuxOk?p=preview

What is wrong here?

Gambo
  • 1,572
  • 3
  • 26
  • 52

3 Answers3

30
  • RC7

Update zone.js pakage by zone.js@0.6.21

<script src="https://unpkg.com/zone.js@0.6.21/dist/zone.js"></script>

  • Angular2.0 release

Update zone.js package by zone.js@0.6.23,

<script src="https://unpkg.com/zone.js@0.6.23?main=browser"></script>
micronyks
  • 54,797
  • 15
  • 112
  • 146
  • 1
    you are right. I had updated my packages.json file but I forgot to run my gulp task that copies the new version into my src directory. Once I did that it all works again. – J King Sep 13 '16 at 16:28
  • 1
    here is the change log that outlines the TWO peer dependency changes: https://github.com/angular/angular/blob/master/CHANGELOG.md core: zone.js@0.6.21 core: rxjs@5.0.0-beta.12 – J King Sep 13 '16 at 16:30
  • confirmed, this was updated in the official tutorial plunker as well: https://angular.io/resources/live-examples/toh-5/ts/plnkr.html – Brian Vander Plaats Sep 14 '16 at 13:57
  • @BrianVanderPlaats. your plunker is hard to understand for anyone as it has so many files. why not to use less files version (RC7 plunker)??? Here it is : http://plnkr.co/edit/NrUanszzdQDGzi1tpuuM?p=preview – micronyks Sep 14 '16 at 18:10
  • @micronyks that plunker was from the Routing Tutorial on the Angular.io site. Thanks for posting a barebones template, looks good. – Brian Vander Plaats Sep 14 '16 at 18:20
  • Welcome. :) ...Yes that I know. But people should start from basics so just referenced it here in case if anybody is willing to go with RC7. – micronyks Sep 14 '16 at 18:22
1

Update package.json file

"zone.js": "0.6.25"

inside dependencies

Engineer
  • 300
  • 1
  • 9
0

Also, after updating to 0.6.23, I received the following error:

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.)

After loading my core-js/client/shim.min.js BEFORE zone.js, my app was working again.

Mindsect Team
  • 2,311
  • 5
  • 29
  • 36