Reputation: 24472
After upgradidng many depencies on an old angular 2 project, I got the following error in runtime:
EXCEPTION: TypeError: Cannot set property 'message' of undefined
ErrorHandler.handleError @ error_handler.js:50
(anonymous) @ application_ref.js:259
ZoneDelegate.invoke @ zone.js:242
onInvoke @ ng_zone.js:269
ZoneDelegate.invoke @ zone.js:241
Zone.run @ zone.js:113
(anonymous) @ zone.js:520
ZoneDelegate.invokeTask @ zone.js:275
onInvokeTask @ ng_zone.js:260
ZoneDelegate.invokeTask @ zone.js:274
Zone.runTask @ zone.js:151
drainMicroTaskQueue @ zone.js:418
zone.js:405Unhandled Promise rejection: TypeError: Cannot set property 'message' of undefined
at ViewWrappedError.set [as message] (errors.js:43)
at ViewWrappedError.ZoneAwareError (zone.js:683)
at ViewWrappedError.BaseError [as constructor] (errors.js:26)
at ViewWrappedError.WrappedError [as constructor] (errors.js:88)
at new ViewWrappedError (errors.js:73)
at CompiledTemplate.proxyViewClass.DebugAppView._rethrowWithContext (view.js:650)
at CompiledTemplate.proxyViewClass.DebugAppView.create (view.js:550)
at CompiledTemplate.proxyViewClass.View_AppComponent0.createInternal (component.ngfactory.js:125)
at CompiledTemplate.proxyViewClass.AppView.create (view.js:95)
at CompiledTemplate.proxyViewClass.DebugAppView.create (view.js:547)
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.createInternal (host.ngfactory.js:26)
at CompiledTemplate.proxyViewClass.AppView.createHostView (view.js:108)
at CompiledTemplate.proxyViewClass.DebugAppView.createHostView (view.js:564)
at ComponentFactory.create (component_factory.js:226)
at ApplicationRef_.bootstrap (application_ref.js:586) ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot set property 'message' of undefined
at ViewWrappedError.set [as message] (errors.js:43)
at ViewWrappedError.ZoneAwareError (zone.js:683)
at ViewWrappedError.BaseError [as constructor] (errors.js:26)
at ViewWrappedError.WrappedError [as constructor] (errors.js:88)
at new ViewWrappedError (errors.js:73)
at CompiledTemplate.proxyViewClass.DebugAppView._rethrowWithContext (view.js:650)
at CompiledTemplate.proxyViewClass.DebugAppView.create (view.js:550)
at CompiledTemplate.proxyViewClass.View_AppComponent0.createInternal (component.ngfactory.js:125)
at CompiledTemplate.proxyViewClass.AppView.create (view.js:95)
at CompiledTemplate.proxyViewClass.DebugAppView.create (view.js:547)
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.createInternal (host.ngfactory.js:26)
at CompiledTemplate.proxyViewClass.AppView.createHostView (view.js:108)
at CompiledTemplate.proxyViewClass.DebugAppView.createHostView (view.js:564)
at ComponentFactory.create (component_factory.js:226)
at ApplicationRef_.bootstrap (application_ref.js:586) undefined
consoleError @ zone.js:405
_loop_1 @ zone.js:434
drainMicroTaskQueue @ zone.js:438
zone.js:407ZoneAwareError {message: "Uncaught (in promise): TypeError: Cannot set prope…p (http://localhost:4200/main.bundle.js:47366:57)", originalStack: "Error: Uncaught (in promise): TypeError: Cannot se… (http://localhost:4200/main.bundle.js:130849:35)", zoneAwareStack: "Error: Uncaught (in promise): TypeError: Cannot se…localhost:4200/main.bundle.js:130849:35) [<root>]", stack: "Error: Uncaught (in promise): TypeError: Cannot se…localhost:4200/main.bundle.js:130849:35) [<root>]", rejection: TypeError: Cannot set property 'message' of undefined
at ViewWrappedError.set [as message] (http……}
I tried to search all my app (which contains about 20 components) for .message
and found only few results I used this.message
property, which I'm sure the problem not from there.
I tried to remove almost all modules and components one by one, and couldn't find a way to fix it.
my package.json:
{
"name": "myapp",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/material": "^2.0.0-alpha.11-3",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.3",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.15",
"@types/hammerjs": "^2.0.32",
"angular2-moment": "^1.0.0",
"angular2-notifications": "^0.4.47",
"core-js": "^2.4.1",
"dragula": "^3.7.1",
"hammerjs": "^2.0.8",
"ng2-bootstrap": "^1.1.16-7",
"ng2-dnd": "^2.0.1",
"ng2-dragula": "^1.2.0",
"ng2-select": "^1.1.2",
"rxjs": "5.0.0-rc.4",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/compiler-cli": "2.2.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.20-4",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}
}
Anyone has any idea how I can locate where this error comes from more efficiently?
Upvotes: 4
Views: 4228
Reputation: 631
It's a problem of zone.js package which prevents the console from showing the actual error! try downgrading zone.js:
npm install --save [email protected]
Upvotes: 6