sockets.forEach is not a function
See original GitHub issueRunning karma 0.13.16 I encountered the following issue after the last test run successfully:
Missing error handler on `socket`.
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/project-path/node_modules/karma/lib/server.js:314:13)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:291:7)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at emitRunCompleteIfAllBrowsersDone (/project-path/node_modules/karma/lib/server.js:256:12)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:278:9)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at [object Object].onComplete (/project-path/node_modules/karma/lib/browser.js:142:13)
at Socket.<anonymous> (/project-path/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:92:20)
at Socket.emit (events.js:172:7)
at Socket.onevent (/project-path/node_modules/socket.io/lib/socket.js:335:8)
at Socket.onpacket (/project-path/node_modules/socket.io/lib/socket.js:295:12)
at Client.ondecoded (/project-path/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/project-path/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/project-path/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/project-path/node_modules/socket.io/lib/client.js:175:18)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Socket.onPacket (/project-path/node_modules/engine.io/lib/socket.js:101:14)
at emitOne (events.js:77:13)
at WebSocket.emit (events.js:169:7)
at WebSocket.Transport.onPacket (/project-path/node_modules/engine.io/lib/transport.js:93:8)
at WebSocket.Transport.onData (/project-path/node_modules/engine.io/lib/transport.js:104:8)
at WebSocket.onData (/project-path/node_modules/engine.io/lib/transports/websocket.js:76:30)
at emitTwo (events.js:87:13)
at WebSocket.emit (events.js:172:7)
at Receiver.ontext (/project-path/node_modules/ws/lib/WebSocket.js:816:10)
at Receiver.parse (/project-path/node_modules/ws/lib/Receiver.hixie.js:145:8)
at doAdd (/project-path/node_modules/ws/lib/Receiver.hixie.js:104:19)
at Receiver.add (/project-path/node_modules/ws/lib/Receiver.hixie.js:108:22)
at Socket.realHandler (/project-path/node_modules/ws/lib/WebSocket.js:800:20)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
05 01 2016 23:59:46.725:WARN [PhantomJS 1.9.8 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
JS 1.9.8 (Linux 0.0.0): Executed 42 of 42 DISCONNECTED (10.248 secs / 0.329 secs)
05 01 2016 23:59:46.726:ERROR [karma]: [TypeError: sockets.forEach is not a function]
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/project-path/node_modules/karma/lib/server.js:314:13)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:291:7)
at emitTwo (events.js:92:20)
at [object Object].emit (events.js:172:7)
at emitRunCompleteIfAllBrowsersDone (/project-path/node_modules/karma/lib/server.js:256:12)
at [object Object].<anonymous> (/project-path/node_modules/karma/lib/server.js:278:9)
at emitOne (events.js:82:20)
at [object Object].emit (events.js:169:7)
at [object Object]._onTimeout (/project-path/node_modules/karma/lib/browser.js:50:15)
at Timer.listOnTimeout (timers.js:92:15)
/project-path/node_modules/karma/lib/server.js:314
sockets.forEach(function (socket) {
^
TypeError: sockets.forEach is not a function
at disconnectBrowsers (/project-path/node_modules/karma/lib/server.js:314:13)
at process.<anonymous> (/project-path/node_modules/karma/lib/server.js:355:5)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
at process._fatalException (node.js:234:26)
I didn’t make any changes to the code or to the test itself but reinstalled the node_modules.
Issue Analytics
- State:
- Created 8 years ago
- Comments:37 (9 by maintainers)
Top Results From Across the Web
TypeError: sockets.forEach is not a function - Stack Overflow
This returns an array containing id's of sockets connected and you can apply forEach on it. Object.keys(io.sockets.sockets).forEach(function(id) ...
Read more >TypeError: forEach is not a function in JavaScript - Stack Diary
The "TypeError: forEach is not a function" error is thrown when the code attempts to call the forEach() method on a value that...
Read more >Rooms | Socket.IO
A room is an arbitrary channel that sockets can join and leave. It can be used to broadcast events to a subset of...
Read more >builtins.Map.forEach JavaScript and Node.js code examples
Best JavaScript code snippets using builtins.Map.forEach(Showing top 15 results out of 684) · Most used builtins functions · Popular in JavaScript.
Read more >Getting forEach is not a function in my component : r/reactjs
I am getting the following error while loading the below component: TypeError: _this2.props.value.forEach is not a function fetchRecords…
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I succeed!!! I input ‘npm install socket.io@1.3.5 --save’ in command and it is work~
Just published
0.13.19
which fixes this.