angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Uncaught TypeError: Cannot read property 'apply' of undefined on new install

Open iainplimmer opened this issue 9 years ago • 103 comments

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.

iainplimmer avatar Apr 22 '17 07:04 iainplimmer

Same Problem here.

moeinpaki avatar Apr 22 '17 11:04 moeinpaki

yeah.. have to downgrade to [email protected] fix this problem it's issue with [email protected].

laiseng avatar Apr 22 '17 11:04 laiseng

Same Problem here.

fifths avatar Apr 22 '17 11:04 fifths

Downgrading to [email protected] works

axtho avatar Apr 22 '17 11:04 axtho

Issues tracked here https://github.com/angular/zone.js/issues/746 and https://github.com/angular/zone.js/issues/747

mpalourdio avatar Apr 22 '17 11:04 mpalourdio

uninstall zone.js and reinstall zone.js using npm will upgrade it to 0.8.8 instead of 0.8.4 so angular/cli 1.0.0 is pointing to wrong version

@laiseng the caret (^) is here to automatically pick safe upgrades in a semver way. Just remove the caret if you want to stick this dependency to a specific version.

mpalourdio avatar Apr 22 '17 11:04 mpalourdio

I have "zone.js": "^0.8.5" but problem still persists.

admiralicic avatar Apr 22 '17 11:04 admiralicic

I have "zone.js": "^0.8.5" but problem still persists.

remove the caret, and rm -rf node_modules && rm yarn.lock && yarn

mpalourdio avatar Apr 22 '17 11:04 mpalourdio

Remove caret (^) and downgrade to 0.8.4. This works for me.

"zone.js": "0.8.4"

avalero85 avatar Apr 22 '17 11:04 avalero85

You have to restart your server after downgrade to [email protected] .

vyava avatar Apr 22 '17 11:04 vyava

[email protected] is working fine with @angular/*@4.0.3. Thanks.

rsaenen avatar Apr 22 '17 12:04 rsaenen

Same here, with [email protected] the problem disappeared, thanks

jfinckh avatar Apr 22 '17 13:04 jfinckh

With [email protected] the problem disappeared, thanks

2r0ck avatar Apr 22 '17 13:04 2r0ck

same error, change the zone.js@^0.8.8 to [email protected] can solve the problem, thanks

TaylorPzreal avatar Apr 22 '17 14:04 TaylorPzreal

Perfect! Back from children duties now. Quick fix is that if you just 'npm install [email protected]' in the root of the application created by the CLI it fixes the issue :)

Well done tracking that one down @all.

iainplimmer avatar Apr 22 '17 14:04 iainplimmer

With [email protected] the problem disappeared, thanks

korolevsa avatar Apr 22 '17 14:04 korolevsa

@iainplimmer No. It is just suppressed. :joy:

biwin avatar Apr 22 '17 14:04 biwin

Change "zone.js":"^0.8.5" to "zone.js":"0.8.5" the problem disappeared, thanks

joseigor avatar Apr 22 '17 18:04 joseigor

Same Problem here.

alex-oliveira avatar Apr 22 '17 19:04 alex-oliveira

same aswell

rubenCodeforges avatar Apr 22 '17 21:04 rubenCodeforges