简体   繁体   中英

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).

  1. Check your processes and terminate the other instance of the node app that is listening on 3000
  2. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM