Running cd openvidu-tutorials/openvidu-basic-node && node index.js
gives following error:
Error: listen EADDRINUSE: address already in use :::5000
at Server.setupListenHandle [as _listen2] (node:net:1372:16)
at listenInCluster (node:net:1420:12)
at Server.listen (node:net:1508:7)
at Object.<anonymous> (/Users/andrey/Sites/openvidu-tutorials/openvidu-basic-node/index.js:35:8)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 5000
}
The reason is – port 5000 is currently used by system processes in macOS:
$ sudo lsof -i :5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 462 andrey 7u IPv4 0x345fc02711044d7 0t0 TCP *:commplex-main (LISTEN)
ControlCe 462 andrey 8u IPv6 0x345fbfda43ba22f 0t0 TCP *:commplex-main (LISTEN)
$ ps 462
PID TT STAT TIME COMMAND
462 ?? S 59:55.47 /System/Library/CoreServices/ControlCenter.app/Contents/MacOS/ControlCenter
Currently, the first step developing with Openvidu on Mac is always – changing default backend port, e.g. to 5001. Other option is to turn off that service in macOS system settings (as described in this StackExchange post), which is also not obvious.
So maybe it’s worth either to change default port in backend apps in Openvidu, or add a short guide to the docs or FAQ?