Uncaught TypeError: Cannot read property 'apply' of undefined on new install
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.0.0 node: 6.9.5 os: darwin x64 @angular/common: 4.0.3 @angular/compiler: 4.0.3 @angular/core: 4.0.3 @angular/forms: 4.0.3 @angular/http: 4.0.3 @angular/platform-browser: 4.0.3 @angular/platform-browser-dynamic: 4.0.3 @angular/router: 4.0.3 @angular/cli: 1.0.0 @angular/compiler-cli: 4.0.3
Repro steps.
npm install -g @angular/cli ng new projectname cd projectname ng serve --> Browse to localhost:4200 in Chrome
The log given by the failure.
When you first open the browser you get the following message: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Then the error Uncaught TypeError: Cannot read property 'apply' of undefined at XMLHttpRequest.desc.get [as ontimeout] (zone.js:1265) at XHRLocalObject.AbstractXHRObject._cleanup (abstract-xhr.js:149) at XMLHttpRequest.xhr.onreadystatechange (abstract-xhr.js:125) at XMLHttpRequest.wrapFn (zone.js:1230) at ZoneDelegate.invokeTask (zone.js:398) at Zone.runTask (zone.js:165) at XMLHttpRequest.ZoneTask.invoke (zone.js:460)
Desired functionality.
Bug fix or the ability to work out why it's not actually working, i've cleaned the NPM cache, reinstalled with -g and still get an error.
Mention any other details that might be useful.
Make sure you restart your application instead of just reloading the webpage ;)
FWIW, working fine on newest versions of:
node: v7.9.0
angular-cli: 1.0.1
@angular/common: 4.0.3
Got from ncu -a
But manually downgrading zone to 0.8.7:
npm i -S [email protected]
Consider removing caret on package.json as on commit above to avoid install zone.js 0.8.8 on later npm installs.
For whatever it's worth, it works in Microsoft Edge :)
I had the same issue, downgraded to zone.js to 0.8.7 and it worked.
I just upgraded to 0.8.8 again (actually ^0.8.7) to test and still works!
I've tested on Chrome, Firefox and Edge.
Go figure...
kleber-swf: Verify that you really did re-upgrade to [email protected] by checking your equivalent to C:\projects\APM-Start-CLI\node_modules\zone.js\package.json and verify that the 5th line (might be higher or lower) shows the following:
"raw": "zone.js@^0.8.8",
In your case, the "magic recovery to using [email protected]" may in fact be using an older edition of zone.js.
To be really certain that zone.js 0.8.8 works, you should delete directory C:\projects\APM-Start-CLI\node_modules\zone.js and then go back and npm install -S [email protected] to verify it has had the miraculous recovery that you mentioned earlier.
zone.js 0.8.5 solved the problem. Thanks.
zone.js 0.8.9 solved the problem
+1 zone.js 0.8.9 is ok here. @iainplimmer this issue can be closed IMO.
@fmorriso you are right! The version in the file is different from the version shown by npm view zone.js version (thanks).
I deleted the folder, run npm update and the version now is 0.8.9, which solves the problem.
Upgrade @angular/core from ^4.0.0 to ^4.0.3 and then upgrade zone.js to ^0.8.5.
I tried to install @angular/cli on my debian server (no prev angular, angular/cli or whatever installed).
I generated test app with ng new zonetest and run it with ng build. Then I hosted the dist/ dir with python -m SimpleHTTPServer. And in chrome, firefox and safari its working fine. But in chromium I get this error (same as on my machine):

I think that this error has nothing to do with zone.js. I don't know what to do, I really need this working in that damn chromium, and I know it worked...
Ok, I solved it, new projects comes with switched off importing polyfills for IE9, IE10 and IE11 (polyfills.ts), uncommenting to actually import them solved my issue with chromium.
@gueroverde It looks like this is fixed in the latest release (0.8.9) too
@gueroverde I had the same issue, can confirm upgrading zone.js to 0.8.9 fixes it.
[email protected] together with [email protected], the issue is still here. Checked in Chrome Version 57.0.2987.133 (64-bit) on OSX Sierra 10.12.4
When downgraded zone to 0.8.7 the issue has gone.

The latest [email protected] with @angular/[email protected] and @angular/[email protected] fixes everything for me
I confirm, I cannot reproduce with [email protected], @angular/[email protected] and @angular/[email protected]
Closing Fixed by Zonejs Update.
I've tried all node.js versions and I'm still getting a similar error.
I'm now on the latest 0.8.11, and everything else is pretty much the latest version.
ERROR TypeError: Cannot read property 'apply' of undefined
at Up (ima3.js:687)
at Sp.L (ima3.js:688)
at Ig (ima3.js:470)
at R (ima3.js:468)
at Ep.B (ima3.js:678)
at Fg (ima3.js:465)
at Bg (ima3.js:466)
at ima3.js:464
at ZoneDelegate.invokeTask (zone.js:424)
at Object.onInvokeTask (core.es5.js:4140)
So it seems to be an issue on here:
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
return this._invokeTaskZS ?
this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
task.callback.apply(applyThis, applyArgs);
};
Anyone has any ideas?