Node.js throws the below "events.js:72 throw er; // Unhandled 'error' even" - node.js

I am running one .js script and new to the node.js, I am getting below errors:
2014-08-12 23:24:20.986 UTC - Server running at 10.11.6.249:9090
events.js:72
throw er; // Unhandled 'error' event
^ Error: listen EADDRNOTAVAIL
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1023:19)
at listen (net.js:1064:10)
at net.js:1146:9
at dns.js:72:18
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
Not sure why these errors are I have closed the port 8000 and re-launch app as well, still facing the same issue.

It is not a problem of port (through I don't understand 8000 or 9090) it is a problem of IP address. Either it was changed and is hardcoded, or IP conflict in network. Run it with 127.0.0.1

Related

Getting Error while connecting mongodb to Node.js app using mongoose atlas

I was trying to connect the MongoDB atlas using mongoose but this is the error I'm getting.
[nodemon] starting `node app.js`
node:events:505
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1372:16)
at listenInCluster (node:net:1420:12)
at Server.listen (node:net:1508:7)
at Function.listen (E:\S and P Global Notes_lect\Nodetest\node_modules\express\lib\application.js:635:24)
at E:\S and P Global Notes_lect\Nodetest\app.js:11:97
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1399:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3000
}
[nodemon] app crashed - waiting for file changes before starting...
First I thought the error was in the password encoding but I solved it then I got this one
You are most likely already running the server in the same port (3000).
Check your processes and terminate the other instance of the node app that is listening on 3000
Check your network to see if port 3000 is already in use by another application
or
Change the port of your node app to listen to another unused port and the error should go away.

why node js socket not working when change port to https?

Normally in app.js i use this code on port 3000 it's work good (on my-domain.com:3000).
.
http.listen(3000, function(){
console.log('start server on port :3000');
});
then i want to use on https, so i change app.js to
http.listen(443, function(){
console.log('start server on port :443');
});
When run node app.js , it's show error
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::443
at Object.exports._errnoException (util.js:1012:11)
at exports._exceptionWithHostPort (util.js:1035:20)
at Server._listen2 (net.js:1252:14)
at listen (net.js:1288:10)
at Server.listen (net.js:1384:5)
at Object.<anonymous> (/home/admin/web/my-domain.com/public_html/app.js:28:6)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
Normally i have to access to my-domain.com:3000 for user chat. So i want to know how can i access to https://www.my-domain.com for user chat ?
You have the following error message:
Error: listen EADDRINUSE :::443
[...]
This message means that the port 443 is currently in use by some process.
You can check which process is actually using the said port by executing one of the many tools for network checking (such as netstat for Windows, lsof or netstat on Linux).
Refer to the manual for those tools to achieve the correct result, based upon your operating system.

Error while running application through NPM node and ember

I am new to this whole npm node concept and currently on learning phase. I am trying to resolve an error that is not letting me perform the Event router for my web application in node. Here is the error below and do let me know what is the problem or issue and what steps to take to resolve it.
Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!
Debugger listening on port 15454
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::8080
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort (util.js:930:20)
at Server._listen2 (net.js:1250:14)
at listen (net.js:1286:10)
at Server.listen (net.js:1382:5)
at EventEmitter.listen (/home/ubuntu/workspace/nodeproject/node_modules/express/lib/application.js:617:24)
at Object.<anonymous> (/home/ubuntu/workspace/nodeproject/app.js:55:5)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
Error: listen EADDRINUSE :::8080
Some other process is already listening on port 8080. Either stop that process or change the port of the ember app.

When running or lifting sails/nodeJS application Error: listen EADDRINUSE

events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1135:5)
at Array.async.auto.start [as 0] (/var/www/html/zentiera/node_modules/sails/lib/hooks/http/start.js:29:35)
While using sails js or node js, The error may create difficulties in newbies of technology.
This specially comes when we try to stop the application using (ctrl+z)
and unfortunately the error creates while restarting it
^Z
[1]+ Stopped sails lift
There are 2 methods to recover this situation :
Need to kill the previous port
fuser -k 9002/tcp
Declare a different port number in your application
localhost//config/local.js
port: process.env.PORT || newPortNumber,

Socket.io server not working

I've got a Socket.io server that is not working (it shows the following error on Firebug and of course it doesn't any of its functions):
GET http://www.example.com:1618/socket.io/1/?t=1401400488401 400 Bad Request 35ms
Also, when I try to run the server, it outputs that:
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1042:14)
at listen (net.js:1064:10)
at net.js:1146:9
at asyncCallback (dns.js:68:16)
at Object.onanswer [as oncomplete] (dns.js:121:9)
I am running it on Ubuntu 14.04
EADDRINUSE means that there is another process that is listening to the port you're using for socket.io. Try changing the port number for socket.io when listen() is called.
On ubuntu, you might need to run it with sudo:
sudo nodejs your_server.js

Resources