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.
I got the same error.
Same issue here. I tried both node v6.10.2 and node v7.9.0.
in firefox works fine
Same here from this morning in chromium. I tried downgrading to angular 4.0.0 but the problem is still here. I can't figure what has changed since yesterday.
Yup Firefox doesn't give this error as mentioned by kGorozhanov.
in firefox i got this message originalDescGet is undefined
@larrygeo same here, but as I never dev in firefox, I don't know if this error was here before.
I've reverted my yarn.lock to an old one (https://github.com/mpalourdio/ng2/commit/b49dc1d63fdbfab7308d6cdbb6f5dffc43035608) and the errors didn't occur neither in firefox, nor in chromium.
Same here. Running an app-version from last weck doesn't throw any error. Diff of package.json: Old (last weekend)
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build -prod",
"test": "ng test --single-run",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.4",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
New (today)
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
i changed the yarn.lock to old one last week, i didn't see the error again.
Im not js developer, but this line of code looks weird in function patchProperty(obj, prop)
delete desc.value; var originalDescGet = desc.get;
if you delete desc.value the getter will return null?
Same issue here. Seems to be a Chromium bug only as Firefox is working fine for me.
If I make a production build the error message is gone.
Must be something with sockjs-node as the error comes when the xhr request is responding to this call: http://localhost:4200/sockjs-node/info?t=1492854252110
Update: Is this maybe the BrowserSync module? I'm not using sockjs-node in my project.
Update:
zone.js want's to get the property __zone_symbol___ontimeout of an xhr object and this property does not exists.
Update:
M'kay, I've got something. Maybe. I'm not quite sure though. There is a property getter inside zone.js/dist/zone.js at line 1245. It says that this getter would return null, if the property is unassigned. Well, the timeout property is unassigned in the xhrobject and tries to get it with hasOwnProperty. As this fails it tries to fallback on the originalDescGet-ter. This is however undefined for some reason. (I guess this is the real issue here). If just simply put the originalDescGet in an if statement and return null otherwise, the error message is gone. I'm not posting code for a reason. It would be a bad-bad practice to change a node_module file locally...
Still looking for an easy fix... XD
Same problem here.
Same Problem here.
Having the same issue with a fresh project started this morning
Having the same problem till yesterday night, glad to see I'm not alone...
i think there is a mixup with npm verisons for zone.js
my package.json shows dependencies
"zone.js": "^0.8.4"
but inspecting
node_modules\zone.js\package.json
shows that it's having different version downloaded by
ng new
"_id": "[email protected]",
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
I upgraded to [email protected] but the error is still present. @laiseng Had you have luck with the update?
Downgraded to [email protected] and the problem disappeared.
Downgraded to [email protected] and the problem disappeared.
Works for me on both Chrome (58.0.3029.81) and Firefox (53.0).