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

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.

Related

How can I trace back "EPROTONOSUPPORT: protocol not supported :::3000" in node.js?

I am more than clueless at the moment. I am trying to start a keystonejs-6 app in production mode and the the app throws this error:
Starting Keystone
node:events:505
throw er; // Unhandled 'error' event
^
Error: listen EPROTONOSUPPORT: protocol not supported :::3000
at Server.setupListenHandle [as _listen2] (node:net:1355:21)
at listenInCluster (node:net:1420:12)
at doListen (node:net:1559:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1399:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EPROTONOSUPPORT',
errno: -43,
syscall: 'listen',
address: '::',
port: 3000
}
I have no way to trace back, at which point of the keystonejs application code the error originated. As it seems, keystonejs provides practically no logging on the application code itself.
Is there a way to find out, what kind of protocol is meant by this error message?

My node process doesn't end on my EC2 server

SO I made an EC-2 Server and I've installed node.js on it. Then, I connected it to port :3000. It was fine untill I noticed that the port was never closed. I had no idea it was still open and tried 'npm run start' multiple times. I just found out that it was alive so I got the PID through "lsof -i TCP:3000" and killed it using 'Kill -9 "PID#" and tried to run the port again. However, it gave me :
node:events:342
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1306:16)
at listenInCluster (node:net:1354:12)
at Server.listen (node:net:1441:7)
at Function.listen (/home/ec2-user/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/ec2-user/index.js:12:5)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1333:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3000
}
So I searched if the port was open again, and it was still open with a different PID. I tried killing it over and over, but it kept showing up with a differnt PID.
If there is something worng or unclear with my question please tell me, I jsut started fiddling with EC2 and all this server things, so I don't know which informations are further required to solve this.
I solved it!!! I typed
killall5 -9
and killed everything and it stopped!

error that wont go away despite numerous changes in node.js

Good evening,
I have the following error and I have no idea what it means, i have googled and changed a few little bit but its very persistent. Is anyone able to offer me some help with the matter?
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::5000
at Server.setupListenHandle [as _listen2] (net.js:1318:16)
at listenInCluster (net.js:1366:12)
at Server.listen (net.js:1452:7)
at Object.<anonymous> (/Users/danielwilstrop/Desktop/projects/live-chat-2/server.js:100:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 5000
}
[nodemon] app crashed - waiting for file changes before starting...
This error is usually caused by a typo on your terminal.
Check if you typed the correct file name in your terminal and also check if the path to your file is correct.
Option 2: check if no other terminals are open in the background. kill all those other terminals, press Ctr+C then run your app again..
There is some other process already using port 5000 so, you are getting this error. To solve this there are two ways
Change the server port from 5000 to something else which port is available eg. 5555 in this file /Users/danielwilstrop/Desktop/projects/live-chat-2/server.js at line number 100 (as shown in the error)
Kill the process that is running on port 5000. Then run the server.js file.
For Linux or mac sudo lsof -ti tcp:5000 | sudo xargs kill
For windows run cmd with administrator privilages netstat -ano|findstr "PID :5000" take the process id from the output and then taskkill /pid <PROCESS_PID_USING_PORT_5000> /f

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.

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

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

Resources