0
I tried to execute the command npm server.js
and he turns me into that mistake:
Error: System EADDRINUSE ::3000 At object. _errnoException (util.js:992:11) at _exceptionWithHostPort (util.js:1014:20) At server.setupListenHandle [as _listen2] (net.js:1355:14) listenInCluster (net.js:1396:12) At Server.Listen (net.js:1480:7) At object. (C: xampp htdocs 123 server.js:15:6) At Module. _Compile (module.js:652:30) At object.Module. _Extensions.. js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) At function.Module. _load (module.js:497:3) At Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:612:3
js server.:
var http= require('http').createServer(function (req,res) {res.end()})
var io = require('socket.io')(http)
var Redis = require('ioredis')
var redis = new Redis(6379,'127.0.0.1')
redis.psubscribe('*', function (){
redis.on('pmessage', function (channel, mensage, pattern){
console.log(channel, mensage, pattern);
})
}
)
http.listen(3000, function (){
console.log('Listeining on porta 3000')
})
I already installed the dependencies npm install socket.io ioredis
.
Can someone help me.
This error indicates that you are already using the port
3000
. Then you can try a) change the port, b) find out the application that is using this port– Sorack
@Sorack, I’m new to Node.js how do I change the port or know what is using the port?
– Cyber Hacker
On the line
http.listen(3000, function (){
swap the3000
to another number.– Sorack
@Sorack obg helped me a lot
– Cyber Hacker