Error - Could not update hosts file

No anti-viruses are used on the machine I run.

I used the default settings for new site
Web server: nginx
PHP Version: 8.1.9
Database: MySQL 8.0.16
WordPress Version: 6.2.2

Also not working if adding another local site.

There message on ‘Local sites’ tab:
"Warning! Missing hosts entry. This site may be inaccessible. Fix It.
I press the Fix it button, nothing happen.

Which version of Local is being used?

What Operating System (OS) and OS version is being used?
Windows 10 Pro build 19045

Attach the Local Log (2.3 KB)

Hi @corrupt! Are you running other developer applications simultaneously? That could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.

Hi @corrupt

If you don’t have a lot of sites in Local yet, in order to refresh here and start with a clean slate could you give the below troubleshooting steps a try?

  • Export any sites that you have on Local and save them to a folder somewhere on your computer.

  • Fully uninstall Local from your computer.

  • Install the latest version of Local on this link.

  • Once installed, please restart the computer.

  • When the computer is restarted and turned on, close any applications that automatically run in the background. (so any lingering security or developer apps)

  • 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!


Hi @corrupt

It looks like you just attached the router log. Can you send us your full log? There are some different ways to access and share Local Logs. For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Also, does changing your Router Mode have any impact? Go to Local>Settings>Advanced to find this.

1 Like

Hi @corrupt!

Thanks for the log!

You’re correct on the steps to get to Router Mode. You can get to it either way, sorry if that was confusing.

I’m curious about something. If you stop all sites that are running in Local and force quit the app, can you try running this in your command prompt? netstat -ano

Do you see any programs still running on ports 80 and 443?

Hi @corrupt

Bingo. So what we were looking for here was to see when sites are stopped and Local is properly shut down if there are still programs running on ports 80 and 443. These may be conflicting with Local or the system may be reporting Local is still running.

If your antivirus is shut down but still using ports, then you kill that process (or processes) by running taskkill /F /pid XXX

XXX is the PID number of that process which you should see in the column on the far right.

After that, you should be able to retry. Keep us posted if you have any questions or continuing issues.

There are also some more details around this and other troubleshooting steps at this link if needed: Stopping Whatever Is Listening On Port 80.

Hi @corrupt

You can try this: Help! I'm running into an EPERM error with the hosts file on Windows

Otherwise, you may need to investigate further what you have installed on your end that is blocking and see what settings or features can be adjusted.

Regarding the Access is Denied error, that could be related to various things on your machine.

1 Like

The link ‘I’m running into an EPERM error’ worked like a magic.
Thank you @Nick-B for your kindness.

1 Like

Glad to hear it @corrupt! Happy Developing :green_heart:

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.