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

Zone version was 0.8.4 and there was that TyprError, When I installed 0.8.5 version it worked without any errors !!!

Migggz avatar Apr 24 '17 11:04 Migggz

zone.js downgrade from 0.8.8 to 0.8.7 worked for me

micsimon avatar Apr 24 '17 13:04 micsimon

Should be fixed by https://github.com/angular/zone.js/pull/747. Wait for the next zone.js release.

kondi avatar Apr 24 '17 14:04 kondi

just do this npm install [email protected] --save

developermahmoud avatar Apr 24 '17 15:04 developermahmoud

Got the same error/issue. Version 0.8.7 fixed it for me.

@angular/[email protected] @[email protected] [email protected]

HFTSOL avatar Apr 24 '17 17:04 HFTSOL

Agreed. Locking to version 0.8.7 fixed it for me. 👍

bentedder avatar Apr 24 '17 21:04 bentedder

Hmmm... doesn't really worked for me. I tried with 0.8.7 and with 0.8.8... Still same Console Error. ¯_(ツ)_/¯

SvenBudak avatar Apr 24 '17 21:04 SvenBudak

  1. update manually package.js setting zone.js:"0.8.5"
  • then run in your app folder, where you have node_modules folder, this command:
  1. npm remove zone.js
  • check in node_modules folder if zone.js was removed

  • then run:

  1. npm install [email protected]
  • check again the node_modules folder to see if zone.js was installed, and check package.js from inside to see if version is 0.8.5.

  • then run:

  1. ng serve --open

You have to do these steps every time after you create a new app or you just do npm install in your app folder, because by default zone.js now comes with version 0.8.8. Thanks and thanks to Rusty from Udemy for this idea.

sorin21 avatar Apr 24 '17 21:04 sorin21

npm ERR! Darwin 16.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "zone.js:@0.8.5" npm ERR! node v6.10.2 npm ERR! npm v3.10.10

npm ERR! Unsupported URL Type: zone.js:@0.8.5 npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! /Users/budi/PhpstormProjects/DevReborn/npm-debug.log

SvenBudak avatar Apr 24 '17 21:04 SvenBudak

My bad @BamiGorengo I made a mistake I put npm install zone.js:@0.8.5 instead of npm install [email protected], without ':'. Now I correct it. Try it again with the steps from above.

sorin21 avatar Apr 24 '17 21:04 sorin21

zone.js 0.8.5 solved my problem too. THanks.

youngmob avatar Apr 24 '17 22:04 youngmob

After i run my ng serve i got this on my console firefoxDeveloperEdition browser: [WDS] Disconnected! vendor.bundle.js:27560:10 GET http://localhost:4200/ [HTTP/1.1 304 Not Modified 68ms] GET http://localhost:4200/inline.bundle.js [HTTP/1.1 304 Not Modified 2ms] GET http://localhost:4200/polyfills.bundle.js [HTTP/1.1 304 Not Modified 20ms] GET http://localhost:4200/styles.bundle.js [HTTP/1.1 304 Not Modified 19ms] GET http://localhost:4200/vendor.bundle.js [HTTP/1.1 304 Not Modified 66ms] GET http://localhost:4200/main.bundle.js [HTTP/1.1 304 Not Modified 65ms] GET XHR http://localhost:4200/sockjs-node/info [HTTP/1.1 200 OK 1ms]

TypeError: originalDescGet is undefined [Aprender más] polyfills.bundle.js:3918:17

GET http://localhost:4200/sockjs-node/540/k2jwl4hl/websocket

ChileNetwork avatar Apr 24 '17 22:04 ChileNetwork

Start it again. To test it you can create a new test app and then follow the steps that I put above. I got the same error in firefox when I didn't change manually from package.js setting zone.js:"0.8.5". Myselft I updated all projects with those steps and now works fine in firefox and chrome.

sorin21 avatar Apr 24 '17 23:04 sorin21

replace dist. dist.zip

ingcrengifo avatar Apr 24 '17 23:04 ingcrengifo

See http://stackoverflow.com/questions/43598863/angular-4-0-3-uncaught-typeerror-cannot-read-property-apply-of-undefined

JanStureNielsen avatar Apr 25 '17 00:04 JanStureNielsen

@hravnx thx !!

wuzhouyang avatar Apr 25 '17 02:04 wuzhouyang

update to [email protected] work for me ,thanks a lot !!

deepthan avatar Apr 25 '17 04:04 deepthan

i got the same error only when i upgraded the zonejs to v0.8.8, i didnt get that error when i was using v0.8.4 but i needed to upgrade because redux didnt work well with old version of zonejs.

when i create the bundle of my app it worked without that error.

nourBerro avatar Apr 25 '17 05:04 nourBerro

zone.js 0.8.7 work, thanks

hanquf1 avatar Apr 25 '17 08:04 hanquf1

using node 6.10.2, npm 4.2.0 and angular 1.0.1, got the same issue. upgrade the zone.js to 0.8.5 fixes the issue. thanks

luongto avatar Apr 25 '17 08:04 luongto