Emitted ‘error’ event on Server instance at: at emitErrorNT

I have an almost similar error to I have the following error code, i am sure my implementation is correct but i am still have error and I’m stuck…

Please i need urgent help

Error: listen EACCES: permission denied mongodb+srv://peters2199:password@cluster0.zuwy0.mongodb.net/voting?retryWrites=true&w=majority
    at Server.setupListenHandle [as _listen2] (net.js:1303:21)
    at listenInCluster (net.js:1368:12)
    at Server.listen (net.js:1465:5)
    at Function.listen (C:\Users\USER\Desktop\server\node_modules\express\lib\application.js:618:24)
    at start (C:\Users\USER\Desktop\server\src\index.js:18:9)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1347:8)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  code: 'EACCES',
  errno: -4092,
  syscall: 'listen',
  address: 'mongodb+srv://peters2199:password@cluster0.zuwy0.mongodb.net/voting?retryWrites=true&w=majority',
  port: -1
}

Hi Ezekiel, welcome to the community.
Did you set up your .env file as mentioned in the lecture?

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Hi Sourabh, thank you very much.
yes i did set up my .env file.

Content of the .env file
MONGO_URI = mongodb+srv://peters2199:peters2199@cluster0.zuwy0.mongodb.net/voting?retryWrites=true&w=majority

Thank you once again, i appreciate.

Hi Ezekiel, sorry I didn’t get you, so is it working now or not?

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Hi Sourabh, it still did not work.

Thanks so much for the reply.

Hi Ezekiel, I tried connecting to your Atlas Deployment, seems like there is something wrong with the credential you provided.


You can manage your users as explained in question 6 of this FAQ article.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

There is something fundamentally wrong with what you are doing.

You are getting an EACCES error on what to appear to be a listen on the Atlas URI. Which is correct and working correctly. So change your password as soon as you read this.

But the big BUT is that you are not supposed to listen to this URI you are supposed to connect to.

I suspect that you pass the wrong argument to what ever API you are using to setup a server. I think you are trying to setup a web server (because you seems to run express module) but you pass the URI of the Atlas cluster rather than the address of your local machine.

1 Like