Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 - TypeError: Cannot read property 'apply' of undefined

I'm developing a very simple Angular 2 application with only one component, one service and one interface but I came across this error and after a few hours of investigating I still can't find an answer.

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)

I can't really understand why the error is keeps appearing, the application is still functional after the mistake appears but it's frustrating.

Any ideas?

like image 958
RichyST Avatar asked Apr 22 '17 07:04

RichyST


2 Answers

Hi I had the same problem and I solve this downgrading to [email protected] and the problem disappeared. Run the following command in your project folder:

npm install [email protected] --save
like image 197
Ricardo Emerson Avatar answered Oct 26 '22 16:10

Ricardo Emerson


for now you could do something like:

rimraf node_modules
npm cache clear
npm i [email protected]
like image 2
Robin Avatar answered Oct 26 '22 14:10

Robin