Error with ionic serve

Wrapping up the cordova serve feature with a livereload is really nice, but I can’t seem to get it to continue to run for a long period of time before it throws an error. The error has to do with the way the livereload watcher is watching files and appears to be adding more listeners than allowed by default. This seems to happen after having started the server and changing a few files, though it is not consistent in how many edits it requires for the error to appear. This appears to be related to one of the node modules used, but I haven’t had a chance to dig into the CLI app yet.

Running dev server at http://0.0.0.0:8100
Running live reload server at http://0.0.0.0:35729
Changed www/views/home/html.html
Changed www/views/home/html.html
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.EventEmitter.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:688:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:13:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)```
1 Like

Hey @gnomeontherun, which version of the CLI are you using?

I’m using the latest, just upgraded yesterday when this began to happen. Before I had been using cordova serve, and had a grunt task that watched and rebuilt the project.

I’m having the same issue.

@gnomeontherun @alexintosh is this error appearing in your command line or browser console?

For me the error appear on the command line.

After I run ‘ionic serve’. Then open new terminal then run ‘protractor protractor.config.js’

The test pass just fine, but the terminal that I had run ‘ionic serve’ show the error.

image

Here is the full stack trace :

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:13:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:13:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:12:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:12:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:13:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:13:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:13:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:12:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:12:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:707:33)
    at module.exports (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/node_modules/finished/index.js:12:10)
    at SendStream.stream (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:526:3)
    at SendStream.send (/usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:470:8)
    at /usr/local/lib/node_modules/ionic/node_modules/connect/node_modules/serve-static/node_modules/send/lib/send.js:382:10
    at Object.oncomplete (fs.js:107:15)

Best Regards,
Prutya