ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'listeners' of undefined

#1

Hello everyone. I’m having the following error in the browser after building my ionic 3 app.

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'listeners' of undefined
TypeError: Cannot read property 'listeners' of undefined
    at module.exports.<anonymous> (main.js:520)
    at module.exports.emit (events.js:146)
    at module.exports.ClientRequest._connect (request.js:268)
    at request.js:159
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (core.js:4626)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.js:4617)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)
    at c (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.js:4617)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)
defaultErrorLogger @ core.js:1350

Ionic Info

Ionic:

ionic (Ionic CLI) : 4.10.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.2

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.3, (and 7 other plugins)

System:

NodeJS : v10.15.1 (/usr/local/bin/node)
npm : 6.7.0
OS : macOS High Sierra

PS: The project was initially built on Windows 10 (Working fine) before switching to Mac Os High Sierra.

#2

Hello,
in the code is anywhere whatever.listeners called. At time you call it, whatever is undefined. Search your code for .listeners and make sure whatever exist at runtime or your code is calling something, that calls whatever.listeners in foreign code. In this case clarify what leads to whatever is undefined.

Best regards, anna-liebt