angular: TypeError: Cannot read property 'zone' of null (touch)
- *I’m submitting a … *
[X] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, see note at the top of this template.
- Do you want to request a feature or report a bug?
See above
- What is the current behavior?
Touch events now function (see: https://github.com/angular/angular/issues/6993) but also output a number of exceptions:
Uncaught TypeError: Cannot read property 'zone' of null
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
See http://plnkr.co/edit/53gbav4XuvWrDt6oEiYO?p=preview
Swipe left on title with console open
- What is the expected behavior?
touch function is called without exceptions
- Please tell us about your environment:
- Angular version: 2.0.0-beta.10
- Browser: [Chrome 48 ]
- Language: [TypeScript]
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 17
- Comments: 51 (15 by maintainers)
i confirmed what @manekinekko sees. it works fine with live-server, but not with lite-server (which uses browser-sync).
here is what i get with bs
im getting same error just using node server to serve a SPA
using angular2 = 2.0.0-beta.11
Same here - beta-11 now gives a similar error in more places and stops the app functioning:
TypeError: Cannot read property 'zone' of undefined
I got a similar error after updating to beta10, app won’t bootstrap:
angular2-polyfills.js:142 Uncaught TypeError: Cannot read property 'zone' of undefined
. Here’s the line 142 from angular2-polyfills:task.zone.cancelTask(task);
beta-12 seems to be running well for me 👍
I checked right now on our main project and it seems to be resolved with beta.12.
Still happens for me, when running a compiled app on a simple node server, using
angular2@2.0.0-beta.10
tobeta.13
+zone.js@0.6.6
. Works fine withangular2@2.0.0-beta.9
+zone.js@0.6.6
.Getting
Uncaught TypeError: Cannot read property 'fork' of undefined
on ng_zone_impl.js (source map) here:I think it all comes down to
socket.io
, since I don’t use anyserver-reloading-module
that depends onbrowser-sync
and I’ve got the same problem.In another project, where I use
ws
instead,beta11
is working just fine.Getting similar error using Ionic 2 beta 3 with Angular 2 beta 11:
Edit: Confirming that downgrading to Beta 9 fixes the issue.
It happens with the pre-built packages in the plunkr so I don’t think typings are going to have any effect one way or the other.
@cpiock this is not related to …‘zone’ of null! i guess your problem is something on path/filesystem!
I think that this issue is somehow related to browsersync. Because when using the Angular 2 CLI, everything works fine.
Update to Beta 12 and the Zone.js to 0.6.6
I just reset my npm install with beta 12 and dependencies, and it works all good !
There’s no mention to it.
I created a
live-reloading-server-module-thing
that doesn’t depend onsocket.io
, so it’s working just fine. For those interested, feel free to check it out.Browsersync author here, please see my comment:
https://github.com/angular/angular/issues/7705#issuecomment-200019429
The issue lies with how socket.io is calling clearTimeout - something the zone.js will be intercepting
recompiles may be slow on TypeScript 1.7. There was a bug with it. Go to 1.8.x
here’s the workaround if you build from source https://github.com/AngularClass/angular2-webpack-starter/commit/1661e4ce847f90547e7bc875c57e8ebdfb3fef98
Seems https://github.com/angular/zone.js/commit/5783663a80926b6154d5c900a3a5645be7bd53bb fixed this. Temp workaround is patching angular2-polyfills.js the with: