Cannot create property '__creationTrace__'

2019-04-03 08:53发布

问题:

This is a bad thursday. It is the 13th. And yesterday I explained to my collegues how lucky we were about the 13th falling on a thursday, not on a friday.

Well, that was yesterday, and today I woke up with angular's fist in my face:

Cannot create property 'creationTrace' on string '__zone_symbol__optimizedZoneEventTask'

Well it might also be zone.js, or maybe even something else deeper down that dark abyss called development stack. Can anybody help me?

Sorry for my attitude, it's just that working with angular since its early alpha-stages has finally taken its toll on me.

PS: Suffice it to say, I did not change anything since the working version yesterday. So I am completely lost as to why and how and where this bug came from...

回答1:

Okey, I managed to find a way-out. zone.js guys recently released a new version you can check it from here. https://github.com/angular/zone.js/releases I think the problem is with this release. In your package.json use zone.js like this

"zone.js": "0.8.12"

If you're using the default Angular template in Plunker, you can set the zone.js version by inserting the versions into appropriate lines of the index.html file.

<script src="https://unpkg.com/zone.js@0.8.12/dist/zone.js"></script>
<script src="https://unpkg.com/zone.js@0.8.12/dist/long-stack-trace-zone.js"></script>


回答2:

As mentioned in https://github.com/angular/zone.js/issues/832 the error happens only in zone.js version 0.8.13 and it is related to event binding.

The bug has been fixed already but for now in order to fix an application you need to downgrade to previous version of zone.js.

"zone.js": "0.8.12" in package.json should do the trick.



回答3:

This error fired to me on plunker with lastest version Angular. I changed the index.html file to get version "0.8.12" (from unpkg.com/zone.js/dist/zone.js to unpkg.com/zone.js@0.8.12/dist/zone.js) and worked.



回答4:

This happens when you are using cdn and zonejs have updated their path URL to differentiate versions.

So modify the path from

https://unpkg.com/zone.js/dist/....

To

https://unpkg.com/zone.js@0.8.12/dist/....

Refer change log here



回答5:

Think I found something:

fixing "zone.js" to version "0.8.12" in the package.json solved the issue for me.



回答6:

I am getting this issue with 'zone.js':"0.8.11"

Unhandled Promise rejection: Cannot create property '__creationTrace__' on string '__zone_symbol__optimizedZoneEventTask' ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot create property '__creationTrace__' on string '__zone_symbol__optimizedZoneEventTask'
    at Object.onScheduleTask (long-stack-trace-zone.js:115)
    at ZoneDelegate.scheduleTask (zone.js:404)
    at Object.onScheduleTask (zone.js:300)
    at ZoneDelegate.scheduleTask (zone.js:404)
    at Zone.scheduleTask (zone.js:235)
    at Zone.scheduleEventTask (zone.js:261)
    at zone.js:1561
    at BrowserPlatformLocation.onPopState (platform-browser.es5.js:1922)
    at PathLocationStrategy.onPopState (common.es5.js:592)
    at new Location (common.es5.js:256)
    at AppBrowserModuleInjector.createInternal (module.ngfactory.js [sm]:1)
    at AppBrowserModuleInjector.NgModuleInjector.create (core.es5.js:3558)
    at NgModuleFactory.create (core.es5.js:3531)
    at core.es5.js:4772
    at ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.es5.js:4149)
    at ZoneDelegate.invoke (zone.js:390)
    at Zone.run (zone.js:141)
    at NgZone.run (core.es5.js:4017)
    at PlatformRef_._bootstrapModuleFactoryWithZone (core.es5.js:4770)
    at core.es5.js:4812
    at ZoneDelegate.invoke (zone.js:391)
    at Zone.run (zone.js:141)
    at zone.js:832
    at ZoneDelegate.invokeTask (zone.js:424)
    at Zone.runTask (zone.js:191)
    at drainMicroTaskQueue (zone.js:596) TypeError: Cannot create property '__creationTrace__' on string '__zone_symbol__optimizedZoneEventTask'
    at Object.onScheduleTask .........


回答7:

I ran into this same problem last night and the following entry for zone.js in my package.json file worked for me:

"zone.js": "0.8.4"



回答8:

This issue have been fixed in zone.js, please updated to the latest version of zone.js