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