Error: connect ECONNREFUSED ::1:27017, connect ECONNREFUSED 127.0.0.1:27017

Good day please I noticed that when I ran npm start or npm start server, the result was “Server Running On Port 8080” later it brought out an Error. The image will explain more though


Also there was a new update in redux js if am not mistaken, that createStore was deprecated and I was advices to use configureStore, okay when I used configureStore on running the command npm start in my terminal it prompted error though causing I using configureStore especially, but after working on my code it didn’t prompt that error again though the file I inputted it didn’t have an errors in my code or what u will call “terminals” in vs code, so pls am I safe like that since it didn’t prompt any errors in my terminal after running the command npm start? Also I was told to use legacy_createStore instead from someone to replace createStore, I used it there was not error prompt in my terminal even without doing extensive work like what I did when inputting configureStore to replace createStore. Please which should I use is it configureStore(what vs code and online told me to use and the updated version of createStore according to reduxjs toolkit I installed) or legacy_createStore (that my friend(Suraj) said I should use an indian?
Please the screenshots will explain better


The first image was when I was told createStore is deprecated, the second is when I inputted configureStore as prompted by vs code in the first popup highlight in the first image in vs code.

@Aravind_Asha_Ramachandran @Besart_H @Carlos_Vilas @dhanya_sankar @Emmanuel_Frimpong @Francesco_Maccari @Guy_Ulrich @Harshit @Ivan_Poyatos_Luque . Pls any help especially for the first image especially no 2 and 3 image are kind of sorted out thanks for ur time

@Andrew_M1 @Bansi_Dholakiya @Daniel_Gonzalez_Reina @Esha_Mahendra @Gokhan_Watches @hiroki_kawakami , @Ilya_Diallo @John_Sewell @Kushagra_Kesav , @Laura_Zhukas1
Pls any help, for the first image though that’s my only issue though but please if u can also provide feedback on the use of configureStore rather than createStore. Thanks

What is your connect string?
Are you using localhost in it?
If yes try to replace with 127.0.0.1 and see if it works
The error indicates issue with IPV6
Please search our forum threads about default usage of Ipv6 vs Ipv4 address

Okay yeah I am using a local host though, there’s no connection string unless u mean mongodb connection url link
Okay will check the ipv6 something u talked about

Pls how will I check ur forum thread about the default usage of ipv6 and ipv4?

I searched for "ipv6"in search button under this poat it didn’t show anything

Sir pls what of my second and 3rd image? Or what I talked about concerning the 2nd and third image about using configureStore to replace createStore in the third image pls am I good to go?

Good day sir I followed ur instruction concerning changing or replacing with 127.0.0.1 and it brought out yhis below

Also I retried that I use b4 and this was the outcome though I believe my editor could have contributed to this issue though , the image is below, thanks

f

Pls any help on this?

Should I use legacy_createStore instead since it’s part of the options I know to replace createStore?

@Ajey_K , @Una_Liang , @xiongyan_zhong @Yogesh_Here @Zokhid_Abdullaev @Vaishali_Panchal @William_Byrne_III @Samyak_Jain5 @Rising_Star @Quonn_Bernard , pls any help on this.Pls am battling on this thing since and the help according to my post I tried it out but it hasn’t helped at all

Pls what am encountering that I thouhht was solved happened again. The inage is below

Check if the MongoDB server is running. You can do this by running the command sudo systemctl status mongod on Linux or brew services list on macOS.

If the server is not running, start it using the command sudo systemctl start mongod on Linux or brew services start mongodb-community on macOS.

If the server is running, check if it is listening on the correct port (27017). You can do this by running the command netstat -an | grep 27017 on Linux or lsof -i :27017 on macOS.

If the server is not listening on the correct port, you can change the port in the MongoDB configuration file (mongod.conf) and restart the server.

If the server is running and listening on the correct port, check if there are any firewall rules blocking the connection. You can temporarily disable the firewall to test if this is the issue.

If none of the above steps work, try reinstalling MongoDB and make sure to follow the installation instructions carefully.

bro, This type of question can be directly asked to ChatGPT.

Yeah thanks sir for the help. Though it’s windows am using though, you mentioned something I should check if it listening on the correct port and yes it is which is port 8080.
I tried changing my mongodb connection string from “mongodb://localhost:27017/” to "mongodb://localhost:0.0.0.0:27017, it worked though but wasn’t giving me what I want. So I tried something else.

Yeaj I was finally able to resolve the issue though, someone was saying my mondo db service wasn’t started
So I tried starting it myself by doikg this:

  1. Pressing windows + R key( it opened a run window, like a command prompt stuff, to send commands of whatever you want your window to do)
  2. I typed “services.msc” pressed, then located the mongodb.exe file in the new popup window, then started the mongodb again on my computer, so that’s how the issue went away and I was able to view my database in my computer.
    Thanks @Kushagra_Kesav for the edit on my post so that others would understand me clearly

I aslo have some questions to ask u, though based on my images below




I am more concerned where it said module not found is it that I should install the module using command prompt or terminal in the project itself?
It’s also saying res is undefined so am thinking of passing it as res.send =“” that is the output would be nothing

This topic was automatically closed after 180 days. New replies are no longer allowed.