Uh-oh! Could not update hosts file
Local ran into a problem when trying to update the hosts file.
Please ensure that the hosts file is not locked by anti-virus.
I disabled the read-only file format
But the problem did not disappear. what is the problem?
Even the PATH thought to change it in the system settings
I have not used the program for this period of time.
The workaround is to directly make changes in the file and insert the ip like all the others. and add a site name
When I start the server, the error pops up again, but the site works. Of course, it is not as convenient as we would like.
When the computer is restarted and turned on, close any applications that automatically run in the background (AntiVirus, Firewall, and other Developer applications included).
Check and see if the issue still persists. If so, please provide us with an updated log. Retrieving Localās Log File
Keep us posted and weād be happy to help further!
Iām not sure what else on your machine could still be blocking things here if youāre unable to uncover anything else. Do you have another machine by chance you can test Local on to see if it works normally?
Hello,
after some troubleshooting and being frustrated, I got it.
Solution 1 -
Somehow my HOSTS file got read only, and after removing the read only status it worked normally.
To do that go to
C:\Windows\System32\drivers\etc
then right click on hosts file and go to properties and under general tab uncheck the read only option and click OK, thats it.
(you have to have administrative privileges)
Now More technical solutionā¦ i.e. Solution 2
::1 sitename.local # Local Site
127.0.0.1 sitename.local # Local Site
::1 www.sitename.local # Local Site
127.0.0.1 www.sitename.local # Local Site
Just add above line to your hosts file and it will work, but do not forget to change āsitenameā to āyoursitenameā.
The errors in your logs still indicate some type of block or permissions issue is happening:
{"class":"Process","level":"warn","message":"nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)","process":"nginx","thread":"main","timestamp":"2024-03-14T18:00:08.171Z"}
{"class":"HostsFileService","error":{},"exitCode":{},"level":"error","message":"Could not update hosts.","stderr":{},"stdout":{},"thread":"main","timestamp":"2024-03-14T18:00:08.293Z"}
{"class":"Process","level":"warn","message":"nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)","process":"nginx","thread":"main","timestamp":"2024-03-14T18:00:10.158Z"}
{"class":"HostsFileService","error":{},"exitCode":{},"level":"error","message":"Could not update hosts.","stderr":{},"stdout":{},"thread":"main","timestamp":"2024-03-14T18:02:21.545Z"}
If you change your Router Mode to Localhost are you able to proceed? Preferences>Advanced>Router Mode>Localhost
Are you running other developer applications simultaneously? That could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.
I had similar issue, this is how i fix it
First go to C:\Windows\System32\drivers\etc and check for a file named āhostsā, make sure to turn on the hidden files show.
If you found the āhostsā file, make sure to uncheck the āread-onlyā property
If you donāt see the āhostsā file, you need to create one, follow this guide for that:
after that, just restart your laptop and it will work fine